Browse Source

add dns_record role

python3
Andrea Cimbalo 7 years ago
parent
commit
dc93d96f48
10 changed files with 22 additions and 2 deletions
  1. +1
    -0
      blogs.yaml
  2. +1
    -0
      ldap.yaml
  3. +1
    -0
      lists.yaml
  4. +1
    -0
      mail.yaml
  5. +1
    -0
      projects.yaml
  6. +12
    -0
      roles/dns_record/tasks/main.yaml
  7. +2
    -2
      roles/lxc_guest/tasks/main.yaml
  8. +1
    -0
      users.yaml
  9. +1
    -0
      webmail.yaml
  10. +1
    -0
      wiki.yaml

+ 1
- 0
blogs.yaml View File

@ -8,6 +8,7 @@
ansible_docker_extra_args: blogs
- hosts: blogs
roles:
- role: dns_record
- role: wordpress
site_names:
- kaos

+ 1
- 0
ldap.yaml View File

@ -8,6 +8,7 @@
ansible_docker_extra_args: ldap
- hosts: ldap
roles:
- role: dns_record
- role: ldap
ldap_domain: 'lilik.it'
ldap_organization: 'LILiK'

+ 1
- 0
lists.yaml View File

@ -8,4 +8,5 @@
ansible_docker_extra_args: lists
- hosts: lists
roles:
- role: dns_record
- role: sympa

+ 1
- 0
mail.yaml View File

@ -8,6 +8,7 @@
ansible_docker_extra_args: mail
- hosts: mail
roles:
- role: dns_record
- role: postfix
ldap_server: "{{ hostvars['ldap'].ansible_host }}"
fqdn_domain: "mail.lilik.it"


+ 1
- 0
projects.yaml View File

@ -9,4 +9,5 @@
ansible_docker_extra_args: projects
- hosts: projects
roles:
- role: dns_record
- role: gitlab

+ 12
- 0
roles/dns_record/tasks/main.yaml View File

@ -0,0 +1,12 @@
- name:
lineinfile:
dest: '/etc/hosts'
line: '{{ ansible_default_ipv4.address }} {{ ansible_hostname }}'
regexp: '^\s*\S* {{ ansible_hostname }}'
delegate_to: gandalf2
register: hosts
- name: restart dnsmasq
shell: "/etc/init.d/dnsmasq restart"
delegate_to: gandalf2
when: hosts.changed

+ 2
- 2
roles/lxc_guest/tasks/main.yaml View File

@ -68,9 +68,9 @@
verbosity: 2
- name: update container DNS configuration
shell: lxc-attach -n {{ vm_name }} --clear-env -e -- bash -c "grep '^nameserver {{ hostvars[ext_gateway].ansible_host }}$' /etc/resolv.conf || echo 'nameserver {{ hostvars[ext_gateway].ansible_host }}' > /etc/resolv.conf"
shell: lxc-attach -n {{ vm_name }} --clear-env -e -- bash -c "grep -Pz1 'domain lilik.it\nnameserver {{ hostvars[ext_gateway].ansible_host }}' /etc/resolv.conf || echo -e 'domain lilik.it\nnameserver {{ hostvars[ext_gateway].ansible_host }}' > /etc/resolv.conf"
register: container_dns_configuration
changed_when: "container_dns_configuration.stdout != 'nameserver {{ hostvars[ext_gateway].ansible_host }}'"
changed_when: container_dns_configuration.stdout != "domain lilik.it\nnameserver {{ hostvars[ext_gateway].ansible_host }}\n\u0000"
- name: update container network configuration
shell: lxc-attach -n {{ vm_name }} --clear-env -e -- bash -c "grep -F 'iface eth0 inet manual' /etc/network/interfaces || sed -i 's/iface eth0 inet dhcp/iface eth0 inet manual/' /etc/network/interfaces"


+ 1
- 0
users.yaml View File

@ -8,6 +8,7 @@
ansible_docker_extra_args: users
- hosts: users
roles:
- role: dns_record
- role: fail2ban
- role: pam-ldap
ldap_server: "{{ hostvars['ldap'].ansible_host }}"


+ 1
- 0
webmail.yaml View File

@ -8,5 +8,6 @@
ansible_docker_extra_args: webmail
- hosts: webmail
roles:
- role: dns_record
- role: roundcube
mail_server: "mail.lilik.it"

+ 1
- 0
wiki.yaml View File

@ -8,4 +8,5 @@
ansible_docker_extra_args: wiki
- hosts: wiki
roles:
- role: dns_record
- role: dokuwiki

Loading…
Cancel
Save