You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
YAML
62 lines
1.4 KiB
YAML
- hosts: localhost
|
|
connection: local
|
|
gather_facts: no
|
|
tasks:
|
|
- name: Create and start containers
|
|
lxd_container:
|
|
name: "{{ item.name }}"
|
|
state: started
|
|
devices:
|
|
eth0:
|
|
ipv4.address: "{{ item.ip }}"
|
|
nictype: bridged
|
|
parent: lxdbr0
|
|
type: nic
|
|
source:
|
|
type: image
|
|
server: https://cloud-images.ubuntu.com/releases
|
|
protocol: simplestreams
|
|
alias: "16.04"
|
|
profiles: ["default"]
|
|
wait_for_ipv4_addresses: true
|
|
timeout: 600
|
|
with_items:
|
|
- name: curso1
|
|
ip: 10.10.10.31
|
|
- name: curso2
|
|
ip: 10.10.10.32
|
|
|
|
- hosts: containers
|
|
connection: lxd
|
|
gather_facts: no
|
|
tasks:
|
|
- name: install python
|
|
raw: yum install -y python
|
|
|
|
- name: install ssh
|
|
yum:
|
|
name:
|
|
- openssh-server
|
|
- vim
|
|
|
|
- name: set passwd user
|
|
user:
|
|
name: root
|
|
password: "{{ password | password_hash('sha512') }}"
|
|
|
|
- name: configure ssh
|
|
lineinfile:
|
|
regexp: "{{ item.regexp }}"
|
|
path: "/etc/ssh/sshd_config"
|
|
line: "{{ item.line }}"
|
|
with_items:
|
|
- regexp: "^PermitRootLogin"
|
|
line: "PermitRootLogin yes"
|
|
- regexp: "^PasswordAuthentication"
|
|
line: "PasswordAuthentication yes"
|
|
|
|
- name: restart sshd
|
|
service:
|
|
name: sshd
|
|
state: restarted
|