Created
May 6, 2016 21:24
-
-
Save ysolis/3ff6a2b89b7e0aaf0af5967fbbb2ee2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: create lxc server | |
command: lxc init ubuntu:trusty server | |
ignore_errors: yes | |
- name: start instance if already created | |
shell: lxc start server && sleep 10 | |
ignore_errors: yes | |
- name: copy key to new lxc instance | |
command: lxc file push --uid=1000 --gid=1000 --mode=0644 pubkey server/home/ubuntu/.ssh/authorized_keys | |
- name: get server ip | |
shell: lxc info server | grep eth0 | head -n 1 | cut -f 3 | |
register: ip | |
- name: add to servers group | |
add_host: | |
hostname: '{{ ip.stdout }}' | |
groups: servers | |
ansible_ssh_user: ubuntu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment