Browse Source

fix destroy container and ldap role

services
kaos 9 years ago
parent
commit
80b9a91478
4 changed files with 19 additions and 6 deletions
  1. +2
    -2
      destroy_container.yaml
  2. +13
    -1
      roles/ldap/tasks/main.yaml
  3. +1
    -0
      roles/lxc_guest/defaults/main.yaml
  4. +3
    -3
      roles/lxc_guest/tasks/main.yaml

+ 2
- 2
destroy_container.yaml View File

@ -1,5 +1,5 @@
---
- hosts: lilikhost
- hosts: vm_hosts
vars_prompt:
- name: container_name
prompt: 'what container should be destroyed?'
@ -17,7 +17,7 @@
name: "{{ container_name }}"
state: stopped
- name: clean LVM volume
command: "dd if=/dev/zero of=/dev/sysvg/vm_{{ container_name }} bs=1M count=128"
command: "dd if=/dev/zero of=/dev/{{ inventory_hostname }}vg/vm_{{ container_name }} bs=1M count=128"
- name: delete lxc container
lxc_container:
name: "{{ container_name }}"


+ 13
- 1
roles/ldap/tasks/main.yaml View File

@ -4,6 +4,12 @@
question: 'slapd/domain'
vtype: 'string'
value: '{{ ldap_domain }}'
- name: configure OpenLDAP (configure)
debconf:
name: 'slapd'
question: 'slapd/dump_database'
vtype: 'string'
value: 'when needed'
- name: configure OpenLDAP (organization)
debconf:
name: 'slapd'
@ -13,12 +19,18 @@
- name: generate admin password
gen_passwd: length=20
register: new_passwd
- name: configure OpenLDAP (password)
- name: configure OpenLDAP (password1)
debconf:
name: 'slapd'
question: 'slapd/password1'
vtype: 'string'
value: '{{ new_passwd.passwd }}'
- name: configure OpenLDAP (password2)
debconf:
name: 'slapd'
question: 'slapd/password2'
vtype: 'string'
value: '{{ new_passwd.passwd }}'
- name: configure phamm-ldap
debconf:
name: 'phamm-ldap'


+ 1
- 0
roles/lxc_guest/defaults/main.yaml View File

@ -1,3 +1,4 @@
---
auto_start: true
container_state: started
distro: jessie

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

@ -13,7 +13,7 @@
fs_type: xfs
container_log: true
template: debian
template_options: --release stretch --packages "ssh python"
template_options: --release {{ distro }} --packages "ssh python"
container_command: |
echo "ssh-rsa {{ user_ca_key }}" > /etc/ssh/user_ca.pub
echo "TrustedUserCAKeys /etc/ssh/user_ca.pub" >> /etc/ssh/sshd_config
@ -37,5 +37,5 @@
name: "{{ vm_name }}"
state: "{{ container_state }}"
when: "lxc_existance.stdout == 'true'"
- name: "waiting for ssh on {{ vm_name }} vm to start"
wait_for: host="{{ hostvars[vm_name]['ansible_host'] }}" port=22 timeout=20
#- name: "waiting for ssh on {{ vm_name }} vm to start"
# wait_for: host="{{ hostvars[vm_name]['ansible_host'] }}" port=22 timeout=20

Loading…
Cancel
Save