diff --git a/.gitignore b/.gitignore index c4655b2..fb32cb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ group_vars/all.yaml -inventory *.retry *.swp *.swo diff --git a/ansible.cfg b/ansible.cfg index aec1df7..93ece26 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,10 +1,6 @@ [defaults] -#connection_plugins = ./ +connection_plugins = ./ #filter_plugins = ./filter_plugin -#[ssh_connection] -#ssh_args = -F ./ssh_config -o ControlMaster=auto -o ControlPersist=30m -#control_path = ~/.ssh/ansible-%%r@%%h:%%p - inventory = hosts diff --git a/destroy_container.yaml b/destroy_container.yaml index 2f9e048..2c2ced8 100644 --- a/destroy_container.yaml +++ b/destroy_container.yaml @@ -1,5 +1,5 @@ --- -- hosts: local +- hosts: localhost tasks: - fail: msg: "please define a vm name with --extra-vars vm=vm_name" @@ -16,7 +16,7 @@ - debug: msg: "{{ ansible_hostname }} cointains a vm named {{ vm }}" - when: '"exists" in container_exists' + when: '"exists" in container_exists and container_exists.exists' - hosts: '{{ lxc_host }}' vars_prompt: diff --git a/firewall.yaml b/firewall.yaml index ec32c0f..b20ea37 100644 --- a/firewall.yaml +++ b/firewall.yaml @@ -1,5 +1,5 @@ --- -- hosts: gandalf2 +- hosts: gandalf roles: - role: openvpn - role: ssh_server diff --git a/hosts b/hosts index b5f8ade..881cb50 100644 --- a/hosts +++ b/hosts @@ -1,3 +1,5 @@ +localhost ansible_connection=local + gandalf ansible_host=10.150.42.1 ansible_user=root biff ansible_host=10.150.40.4 ansible_user=root emmett ansible_host=10.150.40.5 ansible_user=root @@ -15,18 +17,12 @@ login ansible_host=10.150.42.100 ansible_user=root mail ansible_host=10.150.42.36 ansible_user=root matrix ansible_host=10.150.42.26 ansible_user=root media ansible_host=10.150.42.104 ansible_user=root -projects ansible_host=10.150.42.12 ansible_user=root +projects2 ansible_host=10.150.42.12 ansible_user=root +status ansible_host=10.150.42.103 ansible_user=root users ansible_host=10.150.42.18 ansible_user=root webmail ansible_host=10.150.42.14 ansible_user=root wiki ansible_host=10.150.42.16 ansible_user=root -enis ansible_host=192.168.0.101 ansible_user=root -kilil ansible_host=10.150.42.38 ansible_user=root -netjson ansible_host=10.150.42.40 ansible_user=root -prosody ansible_host=10.150.42.27 ansible_user=root -rtfm ansible_host=10.150.42.35 ansible_user=root -seafile ansible_host=10.150.42.25 ansible_user=root - management_gateway ansible_host=10.150.40.1 ansible_user=root vm_gateway ansible_host=10.150.42.1 ansible_user=root reverse_proxy ansible_host=10.150.42.1 ansible_user=root diff --git a/roles/dns_record/tasks/main.yaml b/roles/dns_record/tasks/main.yaml index cdde1da..ed1092c 100644 --- a/roles/dns_record/tasks/main.yaml +++ b/roles/dns_record/tasks/main.yaml @@ -3,10 +3,10 @@ dest: '/etc/hosts' line: '{{ ansible_default_ipv4.address }} {{ ansible_hostname }}' regexp: '^\s*\S* {{ ansible_hostname }}' - delegate_to: gandalf2 + delegate_to: gandalf register: hosts - name: dnsmasq force hosts reload command: "killall -HUP dnsmasq" - delegate_to: gandalf2 + delegate_to: gandalf when: hosts.changed diff --git a/roles/icinga2/tasks/main.yaml b/roles/icinga2/tasks/main.yaml index 4a47ca3..2d525f2 100644 --- a/roles/icinga2/tasks/main.yaml +++ b/roles/icinga2/tasks/main.yaml @@ -93,7 +93,7 @@ - name: create icinga2 hosts directory file: - path: {{ item }} + path: "{{ item }}" state: directory owner: icinga2 group: icinga2 diff --git a/roles/reverse_proxy/tasks/main.yaml b/roles/reverse_proxy/tasks/main.yaml index 8f76749..6b155e6 100644 --- a/roles/reverse_proxy/tasks/main.yaml +++ b/roles/reverse_proxy/tasks/main.yaml @@ -56,6 +56,8 @@ state: directory dest: "/etc/nginx/upstream.conf.d" delegate_to: reverse_proxy + notify: reload nginx + - name: Upload mappings to reverse proxy template: