Finish lxc container and lxc host resources
This commit is contained in:
parent
f6b7cf7843
commit
88f2ba4725
@ -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" ] }
|
||||
|
@ -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
|
@ -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:
|
||||
|
@ -2,3 +2,5 @@
|
||||
sudo: yes
|
||||
roles:
|
||||
- { role: "lxc_hosts", tags: [ "lxc-host", "host-setup" ] }
|
||||
post_tasks:
|
||||
- shell: pip install git+https://github.com/lxc/python2-lxc.git#egg=lxc
|
@ -12,6 +12,9 @@ input:
|
||||
ssh_user:
|
||||
schema: str!
|
||||
value:
|
||||
provides:
|
||||
schema: str
|
||||
value: infra
|
||||
roles:
|
||||
schema: [{value: str}]
|
||||
value:
|
||||
|
Loading…
Reference in New Issue
Block a user