diff --git a/resources/lxc_container/actions/run.yml b/resources/lxc_container/actions/run.yml index f0b6f14f..9b8a4b6a 100644 --- a/resources/lxc_container/actions/run.yml +++ b/resources/lxc_container/actions/run.yml @@ -1,32 +1,25 @@ - - hosts: '*' sudo: yes gather_facts: false # this is default variables, they will be overwritten by resource one vars: - ansible_ssh_host: 10.0.0.4 - container_name: test2 - inventory_hostname: test2 + ansible_ssh_host: 10.0.0.3 + physical_host: 10.0.0.3 + container_name: test3 + inventory_hostname: test3 + properties: + container_release: trusty container_networks: mgmt: - address: 172.18.10.5 + address: 172.18.10.6 bridge: br-test0 - bridge_address: 172.18.10.253/24 + bridge_address: 172.18.10.252/24 interface: eth1 netmask: 255.255.255.0 type: veth - physical_host: 10.0.0.4 - properties: - container_release: trusty + pub_key: '' pre_tasks: - - shell: pip install git+https://github.com/lxc/python2-lxc.git#egg=lxc - - shell: ip l add {{item.value.bridge}} type bridge - with_dict: container_networks - ignore_errors: true - - shell: ip l set {{item.value.bridge}} up - with_dict: container_networks - - shell: ip a add dev {{item.value.bridge}} {{item.value.bridge_address}} - with_dict: container_networks - ignore_errors: true + - set_fact: + lxc_container_ssh_key: "{{ lookup('file', pub_key) }}" roles: - - { role: "lxc_container_create", tags: [ "lxc-container-create" ] } + - { role: "lxc_container_create", tags: [ "lxc-container-create" ] } diff --git a/resources/lxc_container/actions/setup_roles.yml b/resources/lxc_container/actions/setup_roles.yml deleted file mode 100644 index ef6accf6..00000000 --- a/resources/lxc_container/actions/setup_roles.yml +++ /dev/null @@ -1,10 +0,0 @@ - -- stat: path=/tmp/os-ansible-deployment - register: repo -- git: repo=https://github.com/stackforge/os-ansible-deployment.git - dest=/tmp/os-ansible-deployment - when: repo.stat.exists == False -- shell: cp -r /tmp/os-ansible-deployment/playbooks/roles/{{item}} /etc/ansible/roles/ - with_items: - - lxc_container_create - - lxc_container_destroy diff --git a/resources/lxc_container/meta.yaml b/resources/lxc_container/meta.yaml index eb2c3ddb..52d33f92 100644 --- a/resources/lxc_container/meta.yaml +++ b/resources/lxc_container/meta.yaml @@ -15,12 +15,30 @@ input: ansible_ssh_host: schema: str! value: + physical_host: + schema: str! + value: container_address: schema: str! value: container_name: schema: str! value: + inventory_hostname: + schema: str! + value: + container_networks: + schema: {} + value: + properties: + schema: {} + value: + pub_key: + schema: str! + value: + requires: + schema: str + value: roles: schema: [{value: str}] value: diff --git a/resources/lxc_host/actions/run.yml b/resources/lxc_host/actions/run.yml index 62f7e31f..64805e29 100644 --- a/resources/lxc_host/actions/run.yml +++ b/resources/lxc_host/actions/run.yml @@ -1,4 +1,6 @@ - hosts: '*' sudo: yes roles: - - { role: "lxc_hosts", tags: [ "lxc-host", "host-setup" ] } \ No newline at end of file + - { role: "lxc_hosts", tags: [ "lxc-host", "host-setup" ] } + post_tasks: + - shell: pip install git+https://github.com/lxc/python2-lxc.git#egg=lxc \ No newline at end of file diff --git a/resources/lxc_host/meta.yaml b/resources/lxc_host/meta.yaml index 10951ac6..4125e937 100644 --- a/resources/lxc_host/meta.yaml +++ b/resources/lxc_host/meta.yaml @@ -12,6 +12,9 @@ input: ssh_user: schema: str! value: + provides: + schema: str + value: infra roles: schema: [{value: str}] value: