Skip to content

Commit

Permalink
ansible-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur committed May 7, 2019
1 parent 97c50c7 commit 81a0f89
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
8 changes: 4 additions & 4 deletions roles/cdtportal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
openldap_admin_pass: "{{ lookup('password', '../credentials/openldap_admin_pass chars=ascii_letters,digits,hexdigits length=12') }}"

- name: sync application.yaml file for cdtportal
template:
src: ../templates/application.yml.j2
template:
src: application.yml.j2
dest: /{{ docker_volumes }}/{{ cdtportal_service_name }}/config/application.yml
mode: 0755
become: yes
become_method: sudo

- name: sync docker-compose.yml
template:
src: ../templates/docker-compose.yml.j2
template:
src: docker-compose.yml.j2
dest: /tmp/{{ cdtportal_service_name }}/docker-compose.yml
mode: 0755
become: yes
Expand Down
26 changes: 21 additions & 5 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@
become_method: sudo
when: cdt_shutdown_after_2h == "true"

- name: Turn swap off
shell: "nohup swapoff -a &"
- name: Remove swapfile from /etc/fstab
mount:
name: swap
fstype: swap
state: absent
become: yes
become_method: sudo

- name: Disable swap
command: swapoff -a
when: ansible_swaptotal_mb > 0
become: yes
become_method: sudo

Expand All @@ -18,12 +27,15 @@

# Only for centos
- name: remove postfix
package: name=postfix state=absent
package:
name: postfix
state: absent
become: yes
become_method: sudo

- name: Disable SELinux
selinux: state=disabled
selinux:
state: disabled
become: yes
become_method: sudo

Expand Down Expand Up @@ -88,7 +100,9 @@
become_method: sudo

- name: Ensures /etc/systemd/system/docker.service.d dir exists
file: path=/etc/systemd/system/docker.service.d state=directory
file:
path: /etc/systemd/system/docker.service.d
state: directory
become: yes
become_method: sudo

Expand Down Expand Up @@ -154,6 +168,8 @@
module: shell
_raw_params: openssl req -x509 -nodes -days 365 -newkey rsa:2048 -sha256 -subj "/C=UK/ST=LO/O=devopswise/CN=*.{{ base_domain }}" -keyout ../credentials/{{ base_domain }}.key -out ../credentials/{{ base_domain }}.crt -config ../credentials/openssl_req.cfg
when: not (http_ssl_key.stat.exists and http_ssl_crt.stat.exists)
tags:
- skip_ansible_lint

- name: copy generated certificates to cert folder
copy:
Expand Down
5 changes: 3 additions & 2 deletions roles/jenkins/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@

#TODO: This should be moved to openldap playbook
- name: generate key-pair for admin
when: false
local_action:
module: shell
_raw_params: ssh-keygen -t rsa -b 4096 -q -P '' -C 'your_email@example.com' -f ../credentials/openldap_admin_sshkey.pem
when: false

- name: copy add-new-credential.groovy to target
template:
src: ../templates/add-new-credential.groovy.j2
src: add-new-credential.groovy.j2
dest: /tmp/{{ jenkins_service_name }}/add-new-credential.groovy
mode: 0755
become: yes
Expand All @@ -100,3 +99,5 @@
- name: make curl request to jenkins
shell: "curl -k -f --user admin:{{ openldap_admin_pass }} --data-urlencode \"script@/tmp/{{ jenkins_service_name }}/add-new-credential.groovy\" {{ cdt_protocol }}://{{ jenkins_service_name }}.{{ base_domain }}/scriptText"
when: false
tags:
- skip_ansible_lint
4 changes: 2 additions & 2 deletions roles/rocketchat/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
rocketchat_mongodb_pass: "{{ lookup('password', '../credentials/rocketchat_mongodb_pass chars=ascii_letters,digits,hexdigits length=12') }}"

- name: sync docker-compose.yml
template:
src: ../templates/{{ item }}.j2
template:
src: "{{ item }}.j2"
dest: /tmp/{{ rocketchat_service_name }}/{{ item }}
mode: 0755
become: yes
Expand Down
4 changes: 3 additions & 1 deletion roles/traefik/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
register: traefik_http_ssl_key

- name: create openssl configuration file
template:
template:
src: openssl_req.cfg.j2
dest: ../credentials/openssl_req.cfg
delegate_to: localhost
Expand All @@ -52,6 +52,8 @@
_raw_params: openssl req -x509 -nodes -days 365 -newkey rsa:2048 -sha256 -subj "/C=UK/ST=LO/O=devopswise/CN=*.{{ base_domain }}" -keyout ../credentials/traefik_http_ssl.key -out ../credentials/traefik_http_ssl.crt -config ../credentials/openssl_req.cfg
when: not (traefik_http_ssl_key.stat.exists and traefik_http_ssl_crt.stat.exists)
delegate_to: localhost
tags:
- skip_ansible_lint

- name: copy generated certificates to cert folder
copy: src=../credentials/traefik_http_ssl.crt dest={{ docker_volumes }}/{{ traefik_service_name }}/certs/{{ base_domain }}.crt
Expand Down

0 comments on commit 81a0f89

Please sign in to comment.