- hosts: localhost connection: local tasks: - name: where debug: var: new_ip # - meta: end_play # ip, dns, gatewy saerch actuel to delete before update # - name: unset ip via nmcli # nmcli: # type: ethernet # conn_name: "{{ ansible_default_ipv4.interface }}" # state: absent # - meta: end_play - name: set ip via nmcli nmcli: type: ethernet conn_name: "{{ ansible_default_ipv4.interface }}" ip4: "{{ new_ip }}/24" gw4: "{{ new_gw }}" dns4: "{{ new_dns }}" method4: manual dns4_search: - "{{ new_search }}" state: present - name: down interface to apply the change nmcli: conn_name: "{{ ansible_default_ipv4.interface }}" state: down - name: up interface to apply change nmcli: conn_name: "{{ ansible_default_ipv4.interface }}" state: up - name: config DNS template: src: named/named.conf.j2 dest: "{{ dns_conf_file }}" - name: config zone template: src: named/stage-ge.org.zone.j2 dest: "{{ zone_file }}" - name: create reverse script template: src: scripts/createrevers.sh.j2 dest: /tmp/createrevers.sh mode: 0755 - name: create reverse file shell: /tmp/createrevers.sh - name: block enable proxy block: - name: copy proxy.sh to profile copy: src: os/proxy.sh dest: /etc/profile.d/proxy.sh - name: add proxy line to yum.conf lineinfile: path: /etc/yum.conf insertafter: EOF line: proxy=http://proxy.ville-geneve.ch:8080 - name: create folder for proxy docker file: path: /etc/systemd/system/docker.service.d state: directory - name: copy proxy config for docker copy: src: os/proxy.conf dest: /etc/systemd/system/docker.service.d/proxy.conf - name: get root VDG CA get_url: url: "http://intranet.ville-ge.ch/certs/{{ item }}" dest: "/etc/pki/ca-trust/source/anchors/{{ item }}" with_items: - rootcavdg_ROOTVDG-CA.crt - adsubca.crt - name: update ca trust shell: update-ca-trust changed_when: fale when: proxy|bool - name: block disabe proxy block: - name: remove proxy.sh file file: path: /etc/profile.d/proxy.sh state: absent - name: remove proxy line from yum.conf lineinfile: path: /etc/yum.conf regexp: '^proxy' state: absent - name: remove proxy config for docker file: dest: /etc/systemd/system/docker.service.d/proxy.conf state: absent when: not proxy|bool - name: restart all service include_tasks: restart-services.yml