wip
This commit is contained in:
@@ -2,11 +2,15 @@
|
||||
# file: tasks/cloudinit.yml
|
||||
|
||||
- name: cloudinit - install cloud-init packages
|
||||
when: hosts_cloudinit_enable|default(false) and ansible_os_family|lower != "alpine"
|
||||
package: name="cloud-init" state="present"
|
||||
become: yes
|
||||
when: hosts_enable_cloudinit|default(false) and ansible_os_family|lower != "alpine"
|
||||
|
||||
- name: cloudinit - install cloud-init packages
|
||||
- name: cloudinit - alpine - install cloud-init packages
|
||||
when: hosts_cloudinit_enable|default(false) and ansible_os_family|lower == "alpine"
|
||||
with_items:
|
||||
- { "name": "cloud-init", "state": "present" }
|
||||
- { "name": "cloud-init-openrc", "state": "present" }
|
||||
apk:
|
||||
name: "{{ item.name}}"
|
||||
state: "{{ item.state }}"
|
||||
@@ -16,32 +20,29 @@
|
||||
- http://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
- http://dl-cdn.alpinelinux.org/alpine/latest-stable/main
|
||||
- http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
|
||||
with_items:
|
||||
- { "name": "cloud-init", "state": "present" }
|
||||
- { "name": "cloud-init-openrc", "state": "present" }
|
||||
become: yes
|
||||
when: hosts_enable_cloudinit|default(false) and ansible_os_family|lower == "alpine"
|
||||
|
||||
- name: cloudinit - update /etc/cloud/cloud.cfg
|
||||
when: hosts_cloudinit_enable|default(false)
|
||||
template:
|
||||
src: cloud.cfg.j2
|
||||
dest: /etc/cloud/cloud.cfg
|
||||
force: yes
|
||||
when: hosts_enable_cloudinit|default(false)
|
||||
|
||||
- name: cloudinit - activate service
|
||||
when: hosts_cloudinit_enable|default(false) and ansible_service_mgr|lower != "openrc"
|
||||
service:
|
||||
name: cloud-init
|
||||
state: started
|
||||
enabled: yes
|
||||
when: hosts_enable_cloudinit|default(false) and ansible_service_mgr|lower != "openrc"
|
||||
become: yes
|
||||
|
||||
- name: cloudinit - activate service (openrc)
|
||||
when: hosts_cloudinit_enable|default(false) and ansible_service_mgr|lower == "openrc"
|
||||
service:
|
||||
name: cloud-init
|
||||
state: started
|
||||
enabled: yes
|
||||
runlevel: boot
|
||||
when: hosts_enable_cloudinit|default(false) and ansible_service_mgr|lower == "openrc"
|
||||
become: yes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user