Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (43 sloc) 1.5 KB
---
- hosts: localhost
##gather_facts: no
vars:
instanceid: "debian-721"
hostname: "mantis"
password: "xxxxyyyyzzzz"
lochostname: "{{ hostname }}"
fqdn: "{{ hostname }}.gxize.local"
path: "/home/flr/.ansible/yaml"
tasks:
- name: Create | VM-Files Dir
file: path="{{ path }}/files/{{ hostname }}" state=directory
- name: Generate | ssh-keys
command: "ssh-keygen -f files/{{ hostname }}/{{ hostname }} -b 4096 -C {{ hostname }}_{{ ansible_date_time.date }}"
- name: Template | User-Data
template:
src: templates/userdata.j2
dest: "{{ path }}/files/{{ hostname }}/user-data"
owner: flr
group: kvm
mode: 0640
- name: Template | Meta-Data
template:
src: templates/metadata.j2
dest: "{{ path }}/files/{{ hostname }}/meta-data"
owner: flr
group: kvm
mode: 0640
- name: Symlink | User-Data
file:
src: "{{ path }}/files/{{ hostname }}/user-data"
dest: "{{ path }}/files/{{ hostname }}/_cloudinit_userdata_{{ instanceid }}.txt"
state: link
- name: Synlink | Meta-Data
file:
src: "{{ path }}/files/{{ hostname }}/meta-data"
dest: "{{ path }}/files/{{ hostname }}/_cloudinit_metadata_{{ instanceid }}.txt"
state: link
- name: Generate | Iso
command: "genisoimage -output {{ path }}/files/{{ hostname }}/{{ hostname }}-cidata.iso -volid cidata -joliet -rock files/user-data files/meta-data"
### add vars section as vault file
### it contains sensitive info like passwords