-
Notifications
You must be signed in to change notification settings - Fork 2
/
provision.yml
37 lines (31 loc) · 1011 Bytes
/
provision.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
- name: Provision lxc containers
hosts: all
become: True
vars:
users: [root, ansible]
key: "/home/{{ lookup('env', 'USER') }}/.ssh/id_rsa.pub"
debug: True
tasks:
# Install packages
- name: Install Base packages
yum: name="@Base" state=present
when: ansible_pkg_mgr == "yum"
- name: EPEL
yum: name=epel-release
when: ansible_pkg_mgr == "yum"
- name: Required packages
package: name={{ item }} state=present
with_items: [openssh-server, sudo, python-passlib, subversion, git]
- name: Debug packages
package: name={{ item }} state=present
with_items: [vim, telnet, net-tools, fuse-sshfs]
when: debug
- name: Create users
user: name={{ item }} shell=/bin/bash
with_items: "{{ users }}"
# Allow ssh access
- name: Copy public key
authorized_key: user={{ item }} key={{ lookup('file', key) }}
with_items: "{{ users }}"
- name: Start sshd
service: name=sshd state=started