ansible_lxd_tests/Playbooks/01-A-OPENLDAP.yml

45 lines
1.3 KiB
YAML

# ansible-playbook Playbooks/01-A-OPENLDAP.yml -i Inventories/QA -v -t 'deploy' --ask-become-pass
# ansible-playbook Playbooks/01-A-OPENLDAP.yml -i Inventories/QA -v -t 'deploy' --become-password-file
############# TO DO
# usar el socket sin sudo
# storage pool zfs
#############
- hosts: ubuntu_lxd
gather_facts: false
vars:
service_name: OpenLDAP
service_dir: "/home/{{ansible_user}}/OpenLDAP"
profile: default
ssh_key_file: "/root/.ssh/lxd"
tasks:
# Copio el manifest.
- file: path="{{service_dir}}" state=directory mode='0755'
- copy: src=Manifests/{{service_name}}/main.tf dest="{{service_dir}}/{{service_name}}.tf"
# Ejecuto el manifest, creo la instancia.
# Se necesita sudo para conectarse con el socket de LXD
- community.general.terraform:
project_path: "{{service_dir}}"
force_init: true
state: present
binary_path: "/home/renzo/.local/bin/terraform"
become: true
register: terraform
- name: Add LXD instance to group 'lxd_instances'
ansible.builtin.add_host:
name: "{{ terraform.outputs.container_ip_address.value }}"
groups: lxd_instances
ansible_lxd_remote: "{{ inventory_hostname }}"
plugin: community.general.lxd
- hosts: lxd_instances
gather_facts: false
become: true
tasks:
- ansible.builtin.ping:
# Borrar clave ssh de mi pc