Commit bf925ade by Alain Takoudjou Committed by Alain Takoudjou

update vm-bootstrap

1 parent a46f452a
......@@ -33,7 +33,7 @@
when: hostname_file.stat.exists == True
- name: setting hosts special line
lineinfile: dest=/etc/hosts line="{{ lookup('file', '/etc/opt/ipv4') }} {{ lookup('file', '/etc/opt/hostname') }}.tl.teralab-datascience.fr {{ lookup('file', '/etc/opt/hostname') }}"
lineinfile: dest=/etc/hosts line="{{ lookup('file', '/etc/opt/ipv4') }} {{ lookup('file', '/etc/opt/hostname') }}.rapid.space {{ lookup('file', '/etc/opt/hostname') }}"
when: hostname_file.stat.exists == True
- name: setting cluster
......@@ -50,21 +50,11 @@
register: hosts_file
- name: Format hosts
script: format_hosts /tmp/hosts tl.teralab-datascience.fr
script: format_hosts /tmp/hosts rapid.space
when: cluster_hash.stat.exists == True
- name: managing resolv.conf file
lineinfile: dest=/etc/resolv.conf line="search tl.teralab-datascience.fr"
- name: adding entry from workspace
lineinfile: dest=/etc/resolv.conf line="nameserver 10.200.218.1"
- name: Delete default nameserver
lineinfile: dest=/etc/resolv.conf line="nameserver 10.0.2.3" state=absent
- name: Delete nameserver 8.8.8.8
lineinfile: dest=/etc/resolv.conf line="nameserver 8.8.8.8" state=absent
when: is_playbook_ok in [False, "False"]
lineinfile: dest=/etc/resolv.conf line="nameserver 8.8.8.8"
- name: Turn off dhclient if it's running
shell: pkill dhclient
......
- name: a play that runs entirely on the ansible host
hosts: 127.0.0.1
connection: local
pre_tasks:
- name: Get mounted disk list
script: roles/vm-bootstrap/files/mounted_disk
register: vd_list
- name: resgister completed variable
stat: path=/etc/opt/vm-bootstrap-completed
register: ansible_completed
vars:
is_playbook_ok: "{{ ansible_completed.stat.exists }}"
logrotate_args:
- name: vm-bootstrap
path: /var/log/vm-bootstrap.log
options:
- weekly
- compress
- rotate 5
- notifempty
- create
- dateext
roles:
- { role: vm-bootstrap, startup_playbook_id: imt-vm-bootstrap.yml }
- ntp
- { role: vm-disks, vd_disk: b, data_n: 1, when: vd_list.stdout.find("vdb") != -1 }
- { role: vm-disks, vd_disk: c, data_n: 2, when: vd_list.stdout.find("vdc") != -1 }
- { role: vm-disks, vd_disk: d, data_n: 3, when: vd_list.stdout.find("vdd") != -1 }
- { role: vm-disks, vd_disk: e, data_n: 4, when: vd_list.stdout.find("vde") != -1 }
- { role: vm-disks, vd_disk: f, data_n: 5, when: vd_list.stdout.find("vdf") != -1 }
- { role: vm-disks, vd_disk: g, data_n: 6 ,when: vd_list.stdout.find("vdg") != -1 }
- { role: vm-disks, vd_disk: h, data_n: 7, when: vd_list.stdout.find("vdh") != -1 }
- { role: vm-disks, vd_disk: i, data_n: 8, when: vd_list.stdout.find("vdi") != -1 }
- { role: vm-disks, vd_disk: j, data_n: 9, when: vd_list.stdout.find("vdj") != -1 }
- { role: vm-disks, vd_disk: k, data_n: 10, when: vd_list.stdout.find("vdk") != -1 }
- role: logrotate
logrotate_scripts: "{{ logrotate_args }}"
when: ansible_completed.stat.exists == False
tasks:
- name: Set tasks complete
file: path=/etc/opt/vm-bootstrap-completed state=touch
when: ansible_completed.stat.exists == False
changed_when: false
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!