1# CLDR Commit Checker playbook 2- hosts: ccc 3 become: yes 4 vars_files: 5 - vars/main.yml 6 - local-vars/local.yml 7 tasks: 8 - name: ensure cldrcc group is there 9 group: 10 name: cldrcc 11 state: present 12 - name: ensure cldrcc user is there 13 user: 14 name: cldrcc 15 groups: 16 - cldrcc 17 append: yes # add to the groups, do not remove 18 state: present 19 create_home: true 20 - name: set up /home/cldrcc/.ssh/ 21 file: 22 path: /home/cldrcc/.ssh/ 23 owner: cldrcc 24 group: cldrcc 25 mode: '0700' 26 state: directory 27 - name: set up /home/cldrcc/.ssh/authorized_keys 28 copy: 29 src: local-vars/cldrcc/id_rsa.pub 30 dest: /home/cldrcc/.ssh/authorized_keys 31 owner: cldrcc 32 group: cldrcc 33 mode: '0600' 34 - name: set up /home/cldrcc/public_html/ 35 file: 36 path: /home/cldrcc/public_html/ 37 owner: cldrcc 38 group: cldrcc 39 mode: '0755' 40 state: directory 41 - name: set up github-markdown.css 42 get_url: 43 dest: /home/cldrcc/public_html/github-markdown.css 44 owner: cldrcc 45 group: cldrcc 46 mode: '0644' 47 force: no 48 url: https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css 49 # from https://github.com/sindresorhus/github-markdown-css 50 - name: Setup publication and indexing 51 blockinfile: 52 path: /etc/nginx/sites-enabled/default 53 block: | 54 # commit checker 55 location ~ ^/cldrcc/(.*)$ { 56 charset utf-8; 57 source_charset utf-8; 58 alias /home/cldrcc/public_html/$1; 59 autoindex on; 60 } 61 marker: '# {mark} ANSIBLE MANAGED COMMIT CHECKER BLOCK' 62 insertafter: '^[\s]*server_name' # the LAST uncommented server block 63 notify: 'Restart Nginx Again' 64 handlers: 65 - name: Restart Nginx Again 66 service: 67 name: nginx 68 state: restarted 69