Gestito parzialmente creazione nuovo utente. Manca insert chiave pubblica.

This commit is contained in:
Emiliano Vavassori 2015-04-15 14:31:28 +02:00
parent 8ab020cb82
commit e5c5d02b6a
10 changed files with 35 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.swp

5
createpasshash.py Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env python
from passlib.hash import sha512_crypt
import getpass
print sha512_crypt.encrypt(getpass.getpass())

5
firstsetup.yml Normal file
View File

@ -0,0 +1,5 @@
---
- hosts: server
roles:
- firstsetup

2
hosts
View File

@ -1,4 +1,4 @@
[server]
primary ansible_ssh_host=10.0.0.1 ansible_ssh_user=root
pdc ansible_ssh_host=10.0.0.1
[clients]

View File

@ -4,39 +4,48 @@
file: name=/etc/yum.repos.d/CentOS-Base.repo state=file
ignore_errors: yes
register: check_repos
sudo: yes
- name: Scarico configurazione per CentOS 6
get_url:
url: http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-release-6-6.el6.centos.12.2.x86_64.rpm
dest: /tmp/centos-release-6-6.el6.centos.12.2.x86_64.rpm
when: check_repos|failed
sudo: yes
- name: Scompatto configurazione CentOS 6
shell: mkdir -p /tmp/centos-release && pushd /tmp/centos-release && rpm2cpio ../centos-release-6-6.el6.centos.12.2.x86_64.rpm | cpio -idmv && popd
when: check_repos|failed
sudo: yes
- name: Copio i repository
shell: cp -f /tmp/centos-release/etc/yum.repos.d/* /etc/yum.repos.d/
when: check_repos|failed
register: centos_repo_installed
sudo: yes
- name: Copio le chiavi di firma GPG
shell: cp -f /tmp/centos-release/etc/pki/rpm-gpg/* /etc/pki/rpm-gpg/
when: check_repos|failed
sudo: yes
# Senza di questa, non è possibile installare EPEL dopo
- name: Prima attivazione repo
shell: yum clean all && yum repolist
when: centos_repo_installed|changed
sudo: yes
- name: Attivo EPEL
yum: name=epel-release state=present
register: epel_installed
sudo: yes
- name: Seconda attivazione repo
shell: yum clean all && yum repolist
when: epel_installed|changed
sudo: yes
- name: Pulizia
shell: rm -rf /tmp/centos-release && rm -f /tmp/centos-release-6-6.el6.centos.12.2.x86_64.rpm /tmp/epel-release-6-8.noarch.rpm
when: check_repos|failed
sudo: yes

View File

@ -3,6 +3,7 @@
- name: Installo pacchetti di gestione
yum: name={{ item }} state=present
when: ansible_os_family == 'ClearOS'
sudo: yes
with_items:
- vim-enhanced
- git

View File

@ -0,0 +1,3 @@
---
- include: mgmtuser.yml

View File

@ -0,0 +1,9 @@
---
- name: Creazione account di gestione Ansible
user: name=amgmt comment="Ansible Management User" group=wheel state=present password=$6$rounds=100000$XvHuMoXtpCksx379$nhlfUn38.oBB7JrDrtwfUisw8T0Bg5InzFq1fw31mcEmGZ2AYFkFK2zC2g04lSfw.kpdSgqH3Dl5q9r1fY6.k.
remote_user: root
- name: Concessione permessi sudo
lineinfile: dest=/etc/sudoers line="amgmt ALL=(ALL:ALL) NOPASSWD:ALL" validate="visudo -cf %s" state=present
remote_user: root

View File

@ -2,4 +2,4 @@
- hosts: server
roles:
- generalize
- base