summaryrefslogtreecommitdiffstats
path: root/ns2.yml
blob: f21652884bced19540dad7edfee68295bff1964d (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
- hosts: ns2
  remote_user: root
  tasks:
    - name: Installation des paquets de base
      yum: name={{ item }} state=present
      with_items:
        - aide
        - bind
        - emacs-nox
        - iotop
        - ipset
        - nmap
        - postfix
        - powertop
        - yum-plugin-fastestmirror
        - yum-plugin-verify
        - screen
        - ntp
        - dovecot-mysql
        - dovecot-pigeonhole

    - name: Installation de la clé ssh pour l'utilisateur root
      authorized_key: user=root key="{{lookup('file', 'files/id_rsa.pub') }}" manage_dir=yes

    - name: Configuration du démon SSH
      lineinfile: dest=/etc/ssh/sshd_config state=present backrefs=yes regexp="^PasswordAuthentication yes"
                  line="PasswordAuthentication no"
      notify: restart sshd

    - name: Configuration yum affichage historique
      lineinfile: dest=/etc/yum.conf create=yes state=present insertafter="installonly_limit"
                  line="history_list_view=cmds"

    - name: Configuration yum clean on remove
      lineinfile: dest=/etc/yum.conf create=yes state=present insertafter="history_list_view=cmds"
                  line="clean_requirements_on_remove=1"

    - name: Root bashrc
      copy: src="files/bashrc" dest=/root/.bashrc mode=644

    - name: Root emacs rc
      copy: src="files/emacs.rc" dest=/root/.emacs mode=644

    - name: Configure la variable EDITOR
      lineinfile: dest=/root/bin/setvars create=yes state=present
                  line="export EDITOR=emacs"

    - name: Serveurs NTP 0.centos.pool.ntp.org désactivé
      lineinfile: dest=/etc/ntp.conf state=present backrefs=yes regexp="^server 0.centos.pool.ntp.org"
                  line="#server 0.centos.pool.ntp.org"

    - name: Serveurs NTP 1.centos.pool.ntp.org désactivé
      lineinfile: dest=/etc/ntp.conf state=present backrefs=yes regexp="^server 1.centos.pool.ntp.org"
                  line="#server 1.centos.pool.ntp.org"

    - name: Serveurs NTP 2.centos.pool.ntp.org désactivé
      lineinfile: dest=/etc/ntp.conf state=present backrefs=yes regexp="^server 2.centos.pool.ntp.org"
                  line="#server 2.centos.pool.ntp.org"

    - name: Serveurs NTP 3.centos.pool.ntp.org désactivé
      lineinfile: dest=/etc/ntp.conf state=present backrefs=yes regexp="^server 3.centos.pool.ntp.org"
                  line="#server 3.centos.pool.ntp.org"

    - name: Configuration serveur NTP actif
      lineinfile: dest=/etc/ntp.conf create=yes state=present insertafter="#server 3.centos.pool.ntp.org"
                  line="server ntp1.casperlefantom.net iburst"
      notify: restart ntpd

    - name: Transfert de mon certificat racine
      copy: src=files/root.pem dest=/root/root.pem mode=444

    - name: État du service named
      service: name=named state=started enabled=yes

    - name: État du service ntpd
      service: name=ntpd state=started enabled=yes



  handlers:
    - name: restart sshd
      service: name=sshd state=restarted

    - name: restart ntpd
      service: name=ntpd state=restarted