From 80623664089e0948421c48753343434e5d57ea54 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Thu, 7 May 2020 19:15:32 +0200 Subject: [PATCH 01/18] [#61] Update to molecule 3.x --- .ansible-lint | 8 ++ .travis.yml | 18 ++--- .yamllint | 2 + defaults/main.yml | 5 +- meta/main.yml | 1 + molecule/agent/Dockerfile.j2 | 20 +++-- molecule/agent/INSTALL.rst | 16 ---- .../playbook.yml => agent/converge.yml} | 4 +- molecule/agent/create.yml | 60 --------------- molecule/agent/destroy.yml | 27 ------- molecule/agent/group_vars/tomcat/main.yml | 3 - molecule/agent/molecule.yml | 26 +++---- molecule/agent/playbook.yml | 13 ---- molecule/agent/prepare.yml | 5 -- molecule/agent/requirements.yml | 5 -- molecule/agent/tests/dumpall.j2 | 1 - molecule/agent/tests/test_agent.yml | 39 +++------- molecule/agent/verifier.yml | 73 ------------------- molecule/agent/verify.yml | 50 +++++++++++++ molecule/change-log-path/Dockerfile.j2 | 20 +++-- molecule/change-log-path/INSTALL.rst | 16 ---- molecule/change-log-path/converge.yml | 6 ++ molecule/change-log-path/create.yml | 60 --------------- molecule/change-log-path/destroy.yml | 27 ------- .../group_vars/tomcat/main.yml | 3 - molecule/change-log-path/molecule.yml | 25 ++++--- molecule/change-log-path/playbook.yml | 13 ---- molecule/change-log-path/prepare.yml | 5 -- molecule/change-log-path/requirements.yml | 5 -- molecule/change-log-path/tests/dumpall.j2 | 1 - .../tests/test_change-log-path.yml | 42 ----------- .../change-log-path/tests/test_tomcat.yml | 30 ++++++++ molecule/change-log-path/verifier.yml | 73 ------------------- molecule/change-log-path/verify.yml | 50 +++++++++++++ molecule/default/Dockerfile.j2 | 20 +++-- molecule/default/INSTALL.rst | 16 ---- molecule/default/converge.yml | 6 ++ molecule/default/create.yml | 60 --------------- molecule/default/destroy.yml | 27 ------- molecule/default/group_vars/tomcat/main.yml | 4 - molecule/default/molecule.yml | 27 ++++--- molecule/default/prepare.yml | 5 -- molecule/default/requirements.yml | 5 -- molecule/default/tests/dumpall.j2 | 1 - molecule/default/tests/test_default.yml | 47 ------------ molecule/default/tests/test_tomcat.yml | 46 ++++++++++++ molecule/default/verifier.yml | 73 ------------------- molecule/default/verify.yml | 50 +++++++++++++ tasks/agent.yml | 4 +- tasks/deploy.yml | 6 +- tasks/install.yml | 2 +- tasks/service.yml | 2 +- test-requirements.txt | 8 +- 53 files changed, 370 insertions(+), 791 deletions(-) create mode 100644 .ansible-lint delete mode 100644 molecule/agent/INSTALL.rst rename molecule/{default/playbook.yml => agent/converge.yml} (59%) delete mode 100644 molecule/agent/create.yml delete mode 100644 molecule/agent/destroy.yml delete mode 100644 molecule/agent/playbook.yml delete mode 100644 molecule/agent/prepare.yml delete mode 100644 molecule/agent/requirements.yml delete mode 100644 molecule/agent/tests/dumpall.j2 delete mode 100644 molecule/agent/verifier.yml create mode 100644 molecule/agent/verify.yml delete mode 100644 molecule/change-log-path/INSTALL.rst create mode 100644 molecule/change-log-path/converge.yml delete mode 100644 molecule/change-log-path/create.yml delete mode 100644 molecule/change-log-path/destroy.yml delete mode 100644 molecule/change-log-path/playbook.yml delete mode 100644 molecule/change-log-path/prepare.yml delete mode 100644 molecule/change-log-path/requirements.yml delete mode 100644 molecule/change-log-path/tests/dumpall.j2 delete mode 100644 molecule/change-log-path/tests/test_change-log-path.yml create mode 100644 molecule/change-log-path/tests/test_tomcat.yml delete mode 100644 molecule/change-log-path/verifier.yml create mode 100644 molecule/change-log-path/verify.yml delete mode 100644 molecule/default/INSTALL.rst create mode 100644 molecule/default/converge.yml delete mode 100644 molecule/default/create.yml delete mode 100644 molecule/default/destroy.yml delete mode 100644 molecule/default/group_vars/tomcat/main.yml delete mode 100644 molecule/default/prepare.yml delete mode 100644 molecule/default/requirements.yml delete mode 100644 molecule/default/tests/dumpall.j2 delete mode 100644 molecule/default/tests/test_default.yml create mode 100644 molecule/default/tests/test_tomcat.yml delete mode 100644 molecule/default/verifier.yml create mode 100644 molecule/default/verify.yml diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..d8ca299 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,8 @@ +exclude_paths: + - ./molecule +parseable: true +skip_list: + - '204' + - '503' +use_default_rules: true +verbosity: 1 diff --git a/.travis.yml b/.travis.yml index 6f5c49e..583369d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,15 @@ --- -language: python -python: "2.7.13" -sudo: required - -env: - - ansible_version: 2.4.0.0 - - ansible_version: 2.5.0.0 - - ansible_version: 2.6.2.0 +language: python +python: "3.7" +os: linux services: - docker - install: - - pip install ansible==${ansible_version} - - pip install -r test-requirements.txt + - pip install pipenv + - pipenv sync script: - - molecule test --all + - pipenv run molecule test --all notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/.yamllint b/.yamllint index 0ce2348..85d2e86 100644 --- a/.yamllint +++ b/.yamllint @@ -1,3 +1,5 @@ +--- + extends: default ignore: | diff --git a/defaults/main.yml b/defaults/main.yml index 9604004..9fac430 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,7 +1,8 @@ --- + ## General -tomcat_version: 8.5.31 +tomcat_version: 9.0.34 ## Service options @@ -10,7 +11,7 @@ tomcat_user: tomcat tomcat_group: tomcat # start on boot -tomcat_service_enabled: yes +tomcat_service_enabled: true # current state: started, stopped tomcat_service_state: started diff --git a/meta/main.yml b/meta/main.yml index 9d60956..b5b1252 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,6 +4,7 @@ galaxy_info: description: Tomcat role min_ansible_version: 2.4.0.0 license: Apache 2.0 + author: idealista platforms: - name: Debian versions: diff --git a/molecule/agent/Dockerfile.j2 b/molecule/agent/Dockerfile.j2 index f8b4e75..faef72e 100644 --- a/molecule/agent/Dockerfile.j2 +++ b/molecule/agent/Dockerfile.j2 @@ -1,9 +1,19 @@ # Molecule managed +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} FROM {{ item.image }} +{% endif %} -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ - elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ - elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi +# install minimal packages for debian slim images +RUN apt-get update && \ + apt-get install -y python sudo bash ca-certificates iproute2 systemd systemd-sysv python-pip && \ + apt-get clean + +# https://github.com/moby/moby/issues/28614#issuecomment-310581026 +STOPSIGNAL SIGRTMIN+3 +RUN systemctl set-default multi-user.target + +# +RUN mkdir -p /usr/share/man/man1 diff --git a/molecule/agent/INSTALL.rst b/molecule/agent/INSTALL.rst deleted file mode 100644 index e26493b..0000000 --- a/molecule/agent/INSTALL.rst +++ /dev/null @@ -1,16 +0,0 @@ -******* -Install -******* - -Requirements -============ - -* Docker Engine -* docker-py - -Install -======= - -.. code-block:: bash - - $ sudo pip install docker-py diff --git a/molecule/default/playbook.yml b/molecule/agent/converge.yml similarity index 59% rename from molecule/default/playbook.yml rename to molecule/agent/converge.yml index 27563e8..35887a9 100644 --- a/molecule/default/playbook.yml +++ b/molecule/agent/converge.yml @@ -1,6 +1,6 @@ --- + - name: Converge hosts: all roles: - - java - - tomcat-role + - role: tomcat-role diff --git a/molecule/agent/create.yml b/molecule/agent/create.yml deleted file mode 100644 index 10fac31..0000000 --- a/molecule/agent/create.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" - vars: - molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" - molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}" - molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" - molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" - tasks: - - name: Create Dockerfiles from image names - template: - src: "{{ molecule_scenario_directory }}/Dockerfile.j2" - dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}" - with_items: "{{ molecule_yml.platforms }}" - register: platforms - - - name: Discover local Docker images - docker_image_facts: - name: "molecule_local/{{ item.item.name }}" - with_items: "{{ platforms.results }}" - register: docker_images - - - name: Build an Ansible compatible image - docker_image: - path: "{{ molecule_ephemeral_directory }}" - name: "molecule_local/{{ item.item.image }}" - dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}" - force: "{{ item.item.force | default(true) }}" - with_items: "{{ platforms.results }}" - when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0 - - - name: Create molecule instance(s) - docker_container: - name: "{{ item.name }}" - hostname: "{{ item.name }}" - image: "molecule_local/{{ item.image }}" - state: started - recreate: false - log_driver: json-file - command: "{{ item.command | default('bash -c \"while true; do sleep 10000; done\"') }}" - privileged: "{{ item.privileged | default(omit) }}" - volumes: "{{ item.volumes | default(omit) }}" - capabilities: "{{ item.capabilities | default(omit) }}" - ports: "{{ item.exposed_ports | default(omit) }}" - ulimits: "{{ item.ulimits | default(omit) }}" - register: server - with_items: "{{ molecule_yml.platforms }}" - async: 7200 - poll: 0 - - - name: Wait for instance(s) creation to complete - async_status: - jid: "{{ item.ansible_job_id }}" - register: docker_jobs - until: docker_jobs.finished - retries: 300 - with_items: "{{ server.results }}" diff --git a/molecule/agent/destroy.yml b/molecule/agent/destroy.yml deleted file mode 100644 index 3ce7478..0000000 --- a/molecule/agent/destroy.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" - vars: - molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" - molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" - tasks: - - name: Destroy molecule instance(s) - docker_container: - name: "{{ item.name }}" - state: absent - force_kill: "{{ item.force_kill | default(true) }}" - register: server - with_items: "{{ molecule_yml.platforms }}" - async: 7200 - poll: 0 - - - name: Wait for instance(s) deletion to complete - async_status: - jid: "{{ item.ansible_job_id }}" - register: docker_jobs - until: docker_jobs.finished - retries: 300 - with_items: "{{ server.results }}" diff --git a/molecule/agent/group_vars/tomcat/main.yml b/molecule/agent/group_vars/tomcat/main.yml index 0048dd2..7135c1a 100644 --- a/molecule/agent/group_vars/tomcat/main.yml +++ b/molecule/agent/group_vars/tomcat/main.yml @@ -1,8 +1,5 @@ --- -## JAVA -java_implementation: openjdk - tomcat_agents_required_libs: - unzip - apt-transport-https diff --git a/molecule/agent/molecule.yml b/molecule/agent/molecule.yml index a8adfc3..a4aecee 100644 --- a/molecule/agent/molecule.yml +++ b/molecule/agent/molecule.yml @@ -1,31 +1,31 @@ --- + dependency: name: galaxy driver: name: docker -lint: - name: yamllint +lint: | + yamllint . + ansible-lint . platforms: - name: tomcat groups: - tomcat - image: idealista/java-role:latest - privileged: True + image: idealista/jdk:8u222-stretch-openjdk-headless + privileged: false + command: '/lib/systemd/systemd' capabilities: - SYS_ADMIN volumes: - '/sys/fs/cgroup:/sys/fs/cgroup:ro' - command: '/lib/systemd/systemd' + tmpfs: + - '/run' + - '/run/lock' + - '/tmp' provisioner: name: ansible - lint: - name: ansible-lint -scenario: - name: agent verifier: - name: goss - enabled: True - lint: - name: flake8 + name: ansible + directory: ./tests diff --git a/molecule/agent/playbook.yml b/molecule/agent/playbook.yml deleted file mode 100644 index d04d28f..0000000 --- a/molecule/agent/playbook.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Converge - hosts: all - pre_tasks: - - name: Tomcat | Installing required dependencies - apt: - pkg: "{{ item }}" - state: present - with_items: - - net-tools - roles: - - java - - tomcat-role diff --git a/molecule/agent/prepare.yml b/molecule/agent/prepare.yml deleted file mode 100644 index 5358b3b..0000000 --- a/molecule/agent/prepare.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: false - tasks: [] diff --git a/molecule/agent/requirements.yml b/molecule/agent/requirements.yml deleted file mode 100644 index 07c5ec1..0000000 --- a/molecule/agent/requirements.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- - -- src: idealista.java-role - version: 3.0.0 - name: java diff --git a/molecule/agent/tests/dumpall.j2 b/molecule/agent/tests/dumpall.j2 deleted file mode 100644 index 901b4ff..0000000 --- a/molecule/agent/tests/dumpall.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ vars | to_nice_yaml }} diff --git a/molecule/agent/tests/test_agent.yml b/molecule/agent/tests/test_agent.yml index f0aa1a5..64b02ab 100644 --- a/molecule/agent/tests/test_agent.yml +++ b/molecule/agent/tests/test_agent.yml @@ -1,50 +1,33 @@ --- -http: - http://localhost:{{ .Vars.tomcat_http_connector_port }}: - status: 200 - {{ range $key := index .Vars.tomcat_agents_config }} - {{ $key.download_url }}: - status: 200 - {{ end }} - service: tomcat: enabled: true running: true user: - {{ .Vars.tomcat_user }}: + tomcat: exists: true groups: - - {{ .Vars.tomcat_group }} + - tomcat group: - {{ .Vars.tomcat_group }}: + tomcat: exists: true -{{ $user := .Vars.tomcat_user }} -{{ $group := .Vars.tomcat_group }} -{{ $install_path := .Vars.tomcat_install_path }} port: - tcp:{{ .Vars.tomcat_http_connector_port }}: + tcp:8080: listening: true + file: - {{ range $key := index .Vars.tomcat_agents_config }} - {{ $install_path }}: + /opt/tomcat/newrelic: filetype: directory exists: true - owner: {{ $user }} - group: {{ $group }} - {{ range $file := index $key.configuration_files}} - {{ $install_path }}/{{ $key.name }}/{{ $file }}: + owner: tomcat + group: tomcat + /opt/tomcat/newrelic/newrelic.yml: exists: true - {{ end }} - {{ range $option := index $key.catalina_opts}} - {{ $install_path }}/bin/setagentenv.sh: + /opt/tomcat/bin/setagentenv.sh: exists: true contains: - - {{ $option }} - {{ end }} - -{{ end }} + - '-javaagent:/opt/tomcat/newrelic/newrelic.jar' diff --git a/molecule/agent/verifier.yml b/molecule/agent/verifier.yml deleted file mode 100644 index 6f0d7fa..0000000 --- a/molecule/agent/verifier.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -# This is an example playbook to execute goss tests. -# Tests need distributed to the appropriate ansible host/groups -# prior to execution by `goss validate`. -# -# The goss ansible module is installed with molecule. The ANSIBLE_LIBRARY -# path is updated appropriately on `molecule verify`. - -# Details about ansible module: -# - https://github.com/indusbox/goss-ansible - -- name: Verify - hosts: all - vars: - goss_version: v0.3.5 - goss_arch: amd64 - goss_dst: /usr/local/bin/goss - goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" - goss_test_directory: /tmp - goss_format: documentation - - vars_files: - - ../../defaults/main.yml - - ../../vars/main.yml - - "{{ playbook_dir }}/group_vars/tomcat/main.yml" - - tasks: - - name: Download and install goss - get_url: - url: "{{ goss_url }}" - dest: "{{ goss_dst }}" - mode: 0755 - - - name: Copy tests to remote - copy: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/{{ item | basename }}" - with_fileglob: - - "{{ playbook_dir }}/tests/test_*.yml" - - - name: Copy vars in json to template - template: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/vars.yml.j2" - with_fileglob: - - "{{ playbook_dir }}/tests/dumpall.j2" - delegate_to: localhost - - - name: Copy vars in json to remote - template: - src: "{{ goss_test_directory }}/vars.yml.j2" - dest: "{{ goss_test_directory }}/vars.yml" - - - name: Register test files - shell: "ls {{ goss_test_directory }}/test_*.yml" - register: test_files - - - name: Execute Goss tests - command: "goss -g {{ item }} --vars {{ goss_test_directory }}/vars.yml validate --format {{ goss_format }}" - register: test_results - with_items: "{{ test_files.stdout_lines }}" - ignore_errors: true - - - name: Display details about the goss results - debug: - msg: "{{ item.stdout_lines }}" - with_items: "{{ test_results.results }}" - - - name: Fail when tests fail - fail: - msg: "Goss failed to validate" - when: item.rc != 0 - with_items: "{{ test_results.results }}" diff --git a/molecule/agent/verify.yml b/molecule/agent/verify.yml new file mode 100644 index 0000000..18be02a --- /dev/null +++ b/molecule/agent/verify.yml @@ -0,0 +1,50 @@ +--- + +- name: Verify + hosts: all + become: true + vars: + goss_version: v0.3.11 + goss_arch: amd64 + goss_dst: /usr/local/bin/goss + goss_sha256sum: 7a751c102abac61fd8dff45f87f36c3732cb5158e1414ab78e6877864fc2f7a4 + goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" + goss_test_directory: /tmp + goss_format: documentation + tasks: + - name: Download and install Goss + get_url: + url: "{{ goss_url }}" + dest: "{{ goss_dst }}" + sha256sum: "{{ goss_sha256sum }}" + mode: 0755 + register: download_goss + until: download_goss is succeeded + retries: 3 + + - name: Copy Goss tests to remote + copy: + src: "{{ item }}" + dest: "{{ goss_test_directory }}/{{ item | basename }}" + with_fileglob: + - "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml" + + - name: Register test files + shell: "ls {{ goss_test_directory }}/test_*.yml" + register: test_files + + - name: Execute Goss tests + command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}" + register: test_results + with_items: "{{ test_files.stdout_lines }}" + + - name: Display details about the Goss results + debug: + msg: "{{ item.stdout_lines }}" + with_items: "{{ test_results.results }}" + + - name: Fail when tests fail + fail: + msg: "Goss failed to validate" + when: item.rc != 0 + with_items: "{{ test_results.results }}" diff --git a/molecule/change-log-path/Dockerfile.j2 b/molecule/change-log-path/Dockerfile.j2 index f8b4e75..faef72e 100644 --- a/molecule/change-log-path/Dockerfile.j2 +++ b/molecule/change-log-path/Dockerfile.j2 @@ -1,9 +1,19 @@ # Molecule managed +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} FROM {{ item.image }} +{% endif %} -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ - elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ - elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi +# install minimal packages for debian slim images +RUN apt-get update && \ + apt-get install -y python sudo bash ca-certificates iproute2 systemd systemd-sysv python-pip && \ + apt-get clean + +# https://github.com/moby/moby/issues/28614#issuecomment-310581026 +STOPSIGNAL SIGRTMIN+3 +RUN systemctl set-default multi-user.target + +# +RUN mkdir -p /usr/share/man/man1 diff --git a/molecule/change-log-path/INSTALL.rst b/molecule/change-log-path/INSTALL.rst deleted file mode 100644 index e26493b..0000000 --- a/molecule/change-log-path/INSTALL.rst +++ /dev/null @@ -1,16 +0,0 @@ -******* -Install -******* - -Requirements -============ - -* Docker Engine -* docker-py - -Install -======= - -.. code-block:: bash - - $ sudo pip install docker-py diff --git a/molecule/change-log-path/converge.yml b/molecule/change-log-path/converge.yml new file mode 100644 index 0000000..35887a9 --- /dev/null +++ b/molecule/change-log-path/converge.yml @@ -0,0 +1,6 @@ +--- + +- name: Converge + hosts: all + roles: + - role: tomcat-role diff --git a/molecule/change-log-path/create.yml b/molecule/change-log-path/create.yml deleted file mode 100644 index 10fac31..0000000 --- a/molecule/change-log-path/create.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" - vars: - molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" - molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}" - molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" - molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" - tasks: - - name: Create Dockerfiles from image names - template: - src: "{{ molecule_scenario_directory }}/Dockerfile.j2" - dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}" - with_items: "{{ molecule_yml.platforms }}" - register: platforms - - - name: Discover local Docker images - docker_image_facts: - name: "molecule_local/{{ item.item.name }}" - with_items: "{{ platforms.results }}" - register: docker_images - - - name: Build an Ansible compatible image - docker_image: - path: "{{ molecule_ephemeral_directory }}" - name: "molecule_local/{{ item.item.image }}" - dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}" - force: "{{ item.item.force | default(true) }}" - with_items: "{{ platforms.results }}" - when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0 - - - name: Create molecule instance(s) - docker_container: - name: "{{ item.name }}" - hostname: "{{ item.name }}" - image: "molecule_local/{{ item.image }}" - state: started - recreate: false - log_driver: json-file - command: "{{ item.command | default('bash -c \"while true; do sleep 10000; done\"') }}" - privileged: "{{ item.privileged | default(omit) }}" - volumes: "{{ item.volumes | default(omit) }}" - capabilities: "{{ item.capabilities | default(omit) }}" - ports: "{{ item.exposed_ports | default(omit) }}" - ulimits: "{{ item.ulimits | default(omit) }}" - register: server - with_items: "{{ molecule_yml.platforms }}" - async: 7200 - poll: 0 - - - name: Wait for instance(s) creation to complete - async_status: - jid: "{{ item.ansible_job_id }}" - register: docker_jobs - until: docker_jobs.finished - retries: 300 - with_items: "{{ server.results }}" diff --git a/molecule/change-log-path/destroy.yml b/molecule/change-log-path/destroy.yml deleted file mode 100644 index 3ce7478..0000000 --- a/molecule/change-log-path/destroy.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" - vars: - molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" - molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" - tasks: - - name: Destroy molecule instance(s) - docker_container: - name: "{{ item.name }}" - state: absent - force_kill: "{{ item.force_kill | default(true) }}" - register: server - with_items: "{{ molecule_yml.platforms }}" - async: 7200 - poll: 0 - - - name: Wait for instance(s) deletion to complete - async_status: - jid: "{{ item.ansible_job_id }}" - register: docker_jobs - until: docker_jobs.finished - retries: 300 - with_items: "{{ server.results }}" diff --git a/molecule/change-log-path/group_vars/tomcat/main.yml b/molecule/change-log-path/group_vars/tomcat/main.yml index 0a32920..d3de6b9 100644 --- a/molecule/change-log-path/group_vars/tomcat/main.yml +++ b/molecule/change-log-path/group_vars/tomcat/main.yml @@ -1,6 +1,3 @@ --- -## JAVA -java_implementation: openjdk - tomcat_logs_path: /var/log/tomcat diff --git a/molecule/change-log-path/molecule.yml b/molecule/change-log-path/molecule.yml index 9b6122b..a4aecee 100644 --- a/molecule/change-log-path/molecule.yml +++ b/molecule/change-log-path/molecule.yml @@ -1,30 +1,31 @@ --- + dependency: name: galaxy driver: name: docker -lint: - name: yamllint +lint: | + yamllint . + ansible-lint . platforms: - name: tomcat groups: - tomcat - image: idealista/java-role:latest - privileged: True + image: idealista/jdk:8u222-stretch-openjdk-headless + privileged: false + command: '/lib/systemd/systemd' capabilities: - SYS_ADMIN volumes: - '/sys/fs/cgroup:/sys/fs/cgroup:ro' - command: '/lib/systemd/systemd' + tmpfs: + - '/run' + - '/run/lock' + - '/tmp' provisioner: name: ansible - lint: - name: ansible-lint -scenario: - name: change-log-path verifier: - name: goss - lint: - name: flake8 + name: ansible + directory: ./tests diff --git a/molecule/change-log-path/playbook.yml b/molecule/change-log-path/playbook.yml deleted file mode 100644 index 13ead4d..0000000 --- a/molecule/change-log-path/playbook.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Converge - hosts: tomcat - pre_tasks: - - name: Tomcat | Installing required dependencies - apt: - pkg: "{{ item }}" - state: present - with_items: - - net-tools - roles: - - java - - tomcat-role diff --git a/molecule/change-log-path/prepare.yml b/molecule/change-log-path/prepare.yml deleted file mode 100644 index 5358b3b..0000000 --- a/molecule/change-log-path/prepare.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: false - tasks: [] diff --git a/molecule/change-log-path/requirements.yml b/molecule/change-log-path/requirements.yml deleted file mode 100644 index 07c5ec1..0000000 --- a/molecule/change-log-path/requirements.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- - -- src: idealista.java-role - version: 3.0.0 - name: java diff --git a/molecule/change-log-path/tests/dumpall.j2 b/molecule/change-log-path/tests/dumpall.j2 deleted file mode 100644 index 901b4ff..0000000 --- a/molecule/change-log-path/tests/dumpall.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ vars | to_nice_yaml }} diff --git a/molecule/change-log-path/tests/test_change-log-path.yml b/molecule/change-log-path/tests/test_change-log-path.yml deleted file mode 100644 index df2c9ab..0000000 --- a/molecule/change-log-path/tests/test_change-log-path.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- - -http: - http://localhost:{{ .Vars.tomcat_http_connector_port }}: - status: 200 - -service: - tomcat: - enabled: true - running: true - -user: - {{ .Vars.tomcat_user }}: - exists: true - groups: - - {{ .Vars.tomcat_group }} - -group: - {{ .Vars.tomcat_group }}: - exists: true - -port: - tcp:{{ .Vars.tomcat_http_connector_port }}: - listening: true -file: - {{ .Vars.tomcat_logs_path }}: - filetype: directory - exists: true - owner: {{ .Vars.tomcat_user }} - group: {{ .Vars.tomcat_group }} - {{ .Vars.tomcat_logs_path }}/catalina.out: - exists: true - {{ .Vars.tomcat_logs_path }}/host-manager.{{ .Vars.ansible_date_time.date }}.log: - exists: true - {{ .Vars.tomcat_logs_path }}/manager.{{ .Vars.ansible_date_time.date }}.log: - exists: true - {{ .Vars.tomcat_logs_path }}/catalina.{{ .Vars.ansible_date_time.date }}.log: - exists: true - {{ .Vars.tomcat_logs_path }}/localhost.{{ .Vars.ansible_date_time.date }}.log: - exists: true - {{ .Vars.tomcat_logs_path }}/localhost_access_log.{{ .Vars.ansible_date_time.date }}.txt: - exists: true diff --git a/molecule/change-log-path/tests/test_tomcat.yml b/molecule/change-log-path/tests/test_tomcat.yml new file mode 100644 index 0000000..029c199 --- /dev/null +++ b/molecule/change-log-path/tests/test_tomcat.yml @@ -0,0 +1,30 @@ +--- + +service: + tomcat: + enabled: true + running: true + +user: + tomcat: + exists: true + groups: + - tomcat + +group: + tomcat: + exists: true + +port: + tcp:8080: + listening: true + +file: + /var/log/tomcat: + filetype: directory + exists: true + owner: tomcat + group: tomcat + /var/log/tomcat/catalina.out: + exists: true + diff --git a/molecule/change-log-path/verifier.yml b/molecule/change-log-path/verifier.yml deleted file mode 100644 index 6f0d7fa..0000000 --- a/molecule/change-log-path/verifier.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -# This is an example playbook to execute goss tests. -# Tests need distributed to the appropriate ansible host/groups -# prior to execution by `goss validate`. -# -# The goss ansible module is installed with molecule. The ANSIBLE_LIBRARY -# path is updated appropriately on `molecule verify`. - -# Details about ansible module: -# - https://github.com/indusbox/goss-ansible - -- name: Verify - hosts: all - vars: - goss_version: v0.3.5 - goss_arch: amd64 - goss_dst: /usr/local/bin/goss - goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" - goss_test_directory: /tmp - goss_format: documentation - - vars_files: - - ../../defaults/main.yml - - ../../vars/main.yml - - "{{ playbook_dir }}/group_vars/tomcat/main.yml" - - tasks: - - name: Download and install goss - get_url: - url: "{{ goss_url }}" - dest: "{{ goss_dst }}" - mode: 0755 - - - name: Copy tests to remote - copy: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/{{ item | basename }}" - with_fileglob: - - "{{ playbook_dir }}/tests/test_*.yml" - - - name: Copy vars in json to template - template: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/vars.yml.j2" - with_fileglob: - - "{{ playbook_dir }}/tests/dumpall.j2" - delegate_to: localhost - - - name: Copy vars in json to remote - template: - src: "{{ goss_test_directory }}/vars.yml.j2" - dest: "{{ goss_test_directory }}/vars.yml" - - - name: Register test files - shell: "ls {{ goss_test_directory }}/test_*.yml" - register: test_files - - - name: Execute Goss tests - command: "goss -g {{ item }} --vars {{ goss_test_directory }}/vars.yml validate --format {{ goss_format }}" - register: test_results - with_items: "{{ test_files.stdout_lines }}" - ignore_errors: true - - - name: Display details about the goss results - debug: - msg: "{{ item.stdout_lines }}" - with_items: "{{ test_results.results }}" - - - name: Fail when tests fail - fail: - msg: "Goss failed to validate" - when: item.rc != 0 - with_items: "{{ test_results.results }}" diff --git a/molecule/change-log-path/verify.yml b/molecule/change-log-path/verify.yml new file mode 100644 index 0000000..18be02a --- /dev/null +++ b/molecule/change-log-path/verify.yml @@ -0,0 +1,50 @@ +--- + +- name: Verify + hosts: all + become: true + vars: + goss_version: v0.3.11 + goss_arch: amd64 + goss_dst: /usr/local/bin/goss + goss_sha256sum: 7a751c102abac61fd8dff45f87f36c3732cb5158e1414ab78e6877864fc2f7a4 + goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" + goss_test_directory: /tmp + goss_format: documentation + tasks: + - name: Download and install Goss + get_url: + url: "{{ goss_url }}" + dest: "{{ goss_dst }}" + sha256sum: "{{ goss_sha256sum }}" + mode: 0755 + register: download_goss + until: download_goss is succeeded + retries: 3 + + - name: Copy Goss tests to remote + copy: + src: "{{ item }}" + dest: "{{ goss_test_directory }}/{{ item | basename }}" + with_fileglob: + - "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml" + + - name: Register test files + shell: "ls {{ goss_test_directory }}/test_*.yml" + register: test_files + + - name: Execute Goss tests + command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}" + register: test_results + with_items: "{{ test_files.stdout_lines }}" + + - name: Display details about the Goss results + debug: + msg: "{{ item.stdout_lines }}" + with_items: "{{ test_results.results }}" + + - name: Fail when tests fail + fail: + msg: "Goss failed to validate" + when: item.rc != 0 + with_items: "{{ test_results.results }}" diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index f8b4e75..faef72e 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -1,9 +1,19 @@ # Molecule managed +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} FROM {{ item.image }} +{% endif %} -RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ - elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ - elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi +# install minimal packages for debian slim images +RUN apt-get update && \ + apt-get install -y python sudo bash ca-certificates iproute2 systemd systemd-sysv python-pip && \ + apt-get clean + +# https://github.com/moby/moby/issues/28614#issuecomment-310581026 +STOPSIGNAL SIGRTMIN+3 +RUN systemctl set-default multi-user.target + +# +RUN mkdir -p /usr/share/man/man1 diff --git a/molecule/default/INSTALL.rst b/molecule/default/INSTALL.rst deleted file mode 100644 index e26493b..0000000 --- a/molecule/default/INSTALL.rst +++ /dev/null @@ -1,16 +0,0 @@ -******* -Install -******* - -Requirements -============ - -* Docker Engine -* docker-py - -Install -======= - -.. code-block:: bash - - $ sudo pip install docker-py diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml new file mode 100644 index 0000000..35887a9 --- /dev/null +++ b/molecule/default/converge.yml @@ -0,0 +1,6 @@ +--- + +- name: Converge + hosts: all + roles: + - role: tomcat-role diff --git a/molecule/default/create.yml b/molecule/default/create.yml deleted file mode 100644 index 10fac31..0000000 --- a/molecule/default/create.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" - vars: - molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" - molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}" - molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" - molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" - tasks: - - name: Create Dockerfiles from image names - template: - src: "{{ molecule_scenario_directory }}/Dockerfile.j2" - dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}" - with_items: "{{ molecule_yml.platforms }}" - register: platforms - - - name: Discover local Docker images - docker_image_facts: - name: "molecule_local/{{ item.item.name }}" - with_items: "{{ platforms.results }}" - register: docker_images - - - name: Build an Ansible compatible image - docker_image: - path: "{{ molecule_ephemeral_directory }}" - name: "molecule_local/{{ item.item.image }}" - dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}" - force: "{{ item.item.force | default(true) }}" - with_items: "{{ platforms.results }}" - when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0 - - - name: Create molecule instance(s) - docker_container: - name: "{{ item.name }}" - hostname: "{{ item.name }}" - image: "molecule_local/{{ item.image }}" - state: started - recreate: false - log_driver: json-file - command: "{{ item.command | default('bash -c \"while true; do sleep 10000; done\"') }}" - privileged: "{{ item.privileged | default(omit) }}" - volumes: "{{ item.volumes | default(omit) }}" - capabilities: "{{ item.capabilities | default(omit) }}" - ports: "{{ item.exposed_ports | default(omit) }}" - ulimits: "{{ item.ulimits | default(omit) }}" - register: server - with_items: "{{ molecule_yml.platforms }}" - async: 7200 - poll: 0 - - - name: Wait for instance(s) creation to complete - async_status: - jid: "{{ item.ansible_job_id }}" - register: docker_jobs - until: docker_jobs.finished - retries: 300 - with_items: "{{ server.results }}" diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml deleted file mode 100644 index 3ce7478..0000000 --- a/molecule/default/destroy.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}" - vars: - molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" - molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" - tasks: - - name: Destroy molecule instance(s) - docker_container: - name: "{{ item.name }}" - state: absent - force_kill: "{{ item.force_kill | default(true) }}" - register: server - with_items: "{{ molecule_yml.platforms }}" - async: 7200 - poll: 0 - - - name: Wait for instance(s) deletion to complete - async_status: - jid: "{{ item.ansible_job_id }}" - register: docker_jobs - until: docker_jobs.finished - retries: 300 - with_items: "{{ server.results }}" diff --git a/molecule/default/group_vars/tomcat/main.yml b/molecule/default/group_vars/tomcat/main.yml deleted file mode 100644 index 9c29019..0000000 --- a/molecule/default/group_vars/tomcat/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- - -## JAVA -java_implementation: openjdk diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index b5badf2..a4aecee 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -1,28 +1,31 @@ --- + dependency: name: galaxy driver: name: docker -lint: - name: yamllint +lint: | + yamllint . + ansible-lint . + platforms: - name: tomcat groups: - tomcat - image: idealista/java-role:latest - privileged: True + image: idealista/jdk:8u222-stretch-openjdk-headless + privileged: false + command: '/lib/systemd/systemd' capabilities: - SYS_ADMIN volumes: - '/sys/fs/cgroup:/sys/fs/cgroup:ro' - command: '/lib/systemd/systemd' + tmpfs: + - '/run' + - '/run/lock' + - '/tmp' + provisioner: name: ansible - lint: - name: ansible-lint -scenario: - name: default verifier: - name: goss - lint: - name: flake8 + name: ansible + directory: ./tests diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml deleted file mode 100644 index 5358b3b..0000000 --- a/molecule/default/prepare.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: false - tasks: [] diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml deleted file mode 100644 index 07c5ec1..0000000 --- a/molecule/default/requirements.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- - -- src: idealista.java-role - version: 3.0.0 - name: java diff --git a/molecule/default/tests/dumpall.j2 b/molecule/default/tests/dumpall.j2 deleted file mode 100644 index 901b4ff..0000000 --- a/molecule/default/tests/dumpall.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ vars | to_nice_yaml }} diff --git a/molecule/default/tests/test_default.yml b/molecule/default/tests/test_default.yml deleted file mode 100644 index 58742fa..0000000 --- a/molecule/default/tests/test_default.yml +++ /dev/null @@ -1,47 +0,0 @@ -http: - http://localhost:{{ .Vars.tomcat_http_connector_port }}: - status: 200 - -service: - tomcat: - enabled: true - running: true - -user: - {{ .Vars.tomcat_user }}: - exists: true - groups: - - {{ .Vars.tomcat_group }} - -group: - {{ .Vars.tomcat_group }}: - exists: true - -port: - tcp:{{ .Vars.tomcat_http_connector_port }}: - listening: true - tcp:{{ .Vars.tomcat_shutdown_port }}: - listening: true - -{{ $webapps_path := .Vars.tomcat_webapps_path }} -file: -{{ range $key, $value := index .Vars.tomcat_pre_installed_folders_deployed }} - {{ $webapps_path }}/{{ $key }}: - exists: {{ $value.deployed }} -{{ end }} - {{ .Vars.tomcat_conf_path }}/test/test_file.xml: - exists: true - {{ .Vars.tomcat_conf_path }}/test/test_template.xml: - exists: true -{{ if ( .Vars.tomcat_download_wars ) and eq .Vars.tomcat_download_wars "true" }} -{{ range index .Vars.tomcat_war_to_deploy_urls }} - {{ $webapps_path }}/{{ .name }}: - exists: true -{{ end }} -{{ end }} - -command: - java -cp {{ .Vars.tomcat_install_path }}/lib/catalina.jar org.apache.catalina.util.ServerInfo | grep 'Server version': - exit-status: 0 - stdout: - - "{{ .Vars.tomcat_version }}" diff --git a/molecule/default/tests/test_tomcat.yml b/molecule/default/tests/test_tomcat.yml new file mode 100644 index 0000000..3d3416c --- /dev/null +++ b/molecule/default/tests/test_tomcat.yml @@ -0,0 +1,46 @@ +--- + +service: + tomcat: + enabled: true + running: true + +user: + tomcat: + exists: true + groups: + - tomcat + +group: + tomcat: + exists: true + +port: + tcp:8080: + listening: true + tcp:8005: + listening: true + +file: + /opt/tomcat/webapps/docs: + exists: true + /opt/tomcat/webapps/examples: + exists: true + /opt/tomcat/webapps/manager: + exists: true + /opt/tomcat/webapps/host-manager: + exists: true + /opt/tomcat/webapps/ROOT: + exists: true + /opt/tomcat/conf/test/test_file.xml: + exists: true + /opt/tomcat/conf/test/test_template.xml: + exists: true + /opt/tomcat/webapps/sample.war: + exists: true + +command: + java -cp /opt/tomcat/lib/catalina.jar org.apache.catalina.util.ServerInfo | grep 'Server version': + exit-status: 0 + stdout: + - "9.0.34" diff --git a/molecule/default/verifier.yml b/molecule/default/verifier.yml deleted file mode 100644 index 6f0d7fa..0000000 --- a/molecule/default/verifier.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -# This is an example playbook to execute goss tests. -# Tests need distributed to the appropriate ansible host/groups -# prior to execution by `goss validate`. -# -# The goss ansible module is installed with molecule. The ANSIBLE_LIBRARY -# path is updated appropriately on `molecule verify`. - -# Details about ansible module: -# - https://github.com/indusbox/goss-ansible - -- name: Verify - hosts: all - vars: - goss_version: v0.3.5 - goss_arch: amd64 - goss_dst: /usr/local/bin/goss - goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" - goss_test_directory: /tmp - goss_format: documentation - - vars_files: - - ../../defaults/main.yml - - ../../vars/main.yml - - "{{ playbook_dir }}/group_vars/tomcat/main.yml" - - tasks: - - name: Download and install goss - get_url: - url: "{{ goss_url }}" - dest: "{{ goss_dst }}" - mode: 0755 - - - name: Copy tests to remote - copy: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/{{ item | basename }}" - with_fileglob: - - "{{ playbook_dir }}/tests/test_*.yml" - - - name: Copy vars in json to template - template: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/vars.yml.j2" - with_fileglob: - - "{{ playbook_dir }}/tests/dumpall.j2" - delegate_to: localhost - - - name: Copy vars in json to remote - template: - src: "{{ goss_test_directory }}/vars.yml.j2" - dest: "{{ goss_test_directory }}/vars.yml" - - - name: Register test files - shell: "ls {{ goss_test_directory }}/test_*.yml" - register: test_files - - - name: Execute Goss tests - command: "goss -g {{ item }} --vars {{ goss_test_directory }}/vars.yml validate --format {{ goss_format }}" - register: test_results - with_items: "{{ test_files.stdout_lines }}" - ignore_errors: true - - - name: Display details about the goss results - debug: - msg: "{{ item.stdout_lines }}" - with_items: "{{ test_results.results }}" - - - name: Fail when tests fail - fail: - msg: "Goss failed to validate" - when: item.rc != 0 - with_items: "{{ test_results.results }}" diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml new file mode 100644 index 0000000..18be02a --- /dev/null +++ b/molecule/default/verify.yml @@ -0,0 +1,50 @@ +--- + +- name: Verify + hosts: all + become: true + vars: + goss_version: v0.3.11 + goss_arch: amd64 + goss_dst: /usr/local/bin/goss + goss_sha256sum: 7a751c102abac61fd8dff45f87f36c3732cb5158e1414ab78e6877864fc2f7a4 + goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" + goss_test_directory: /tmp + goss_format: documentation + tasks: + - name: Download and install Goss + get_url: + url: "{{ goss_url }}" + dest: "{{ goss_dst }}" + sha256sum: "{{ goss_sha256sum }}" + mode: 0755 + register: download_goss + until: download_goss is succeeded + retries: 3 + + - name: Copy Goss tests to remote + copy: + src: "{{ item }}" + dest: "{{ goss_test_directory }}/{{ item | basename }}" + with_fileglob: + - "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml" + + - name: Register test files + shell: "ls {{ goss_test_directory }}/test_*.yml" + register: test_files + + - name: Execute Goss tests + command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}" + register: test_results + with_items: "{{ test_files.stdout_lines }}" + + - name: Display details about the Goss results + debug: + msg: "{{ item.stdout_lines }}" + with_items: "{{ test_results.results }}" + + - name: Fail when tests fail + fail: + msg: "Goss failed to validate" + when: item.rc != 0 + with_items: "{{ test_results.results }}" diff --git a/tasks/agent.yml b/tasks/agent.yml index 14e3d87..e0b2deb 100644 --- a/tasks/agent.yml +++ b/tasks/agent.yml @@ -35,7 +35,7 @@ unarchive: src: "/tmp/{{ item.download_url | basename }}" dest: "{{ tomcat_install_path }}" - remote_src: yes + remote_src: true owner: "{{ tomcat_user }}" group: "{{ tomcat_group }}" mode: 0755 @@ -62,7 +62,7 @@ - name: Tomcat agent installation | Check catalina options set_fact: - tomcat_agent_catalina_opts: "{% set tomcat_agent_catalina_opts = tomcat_agent_catalina_opts|default([]) + [item.1] %}{{tomcat_agent_catalina_opts|list}}" + tomcat_agent_catalina_opts: "{% set tomcat_agent_catalina_opts = tomcat_agent_catalina_opts|default([]) + [item.1] %}{{ tomcat_agent_catalina_opts|list }}" with_subelements: - "{{ tomcat_agents_config }}" - catalina_opts diff --git a/tasks/deploy.yml b/tasks/deploy.yml index efd5fbf..6180110 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -19,7 +19,7 @@ repository_url: "{{ item.repository_url }}" classifier: "{{ item.classifier | default(omit) }}" dest: "{{ tomcat_webapps_path }}/{{ item.name }}" - validate_certs: no + validate_certs: false with_items: "{{ tomcat_war_to_deploy_from_maven }}" notify: restart tomcat when: @@ -36,7 +36,7 @@ repository_url: "{{ item.repository_url }}" classifier: "{{ item.classifier | default(omit) }}" dest: "{{ tomcat_webapps_path }}/{{ item.name }}" - validate_certs: no + validate_certs: false verify_checksum: "{{ item.verify_checksum | default('always') }}" with_items: "{{ tomcat_war_to_deploy_from_maven }}" notify: restart tomcat @@ -57,7 +57,7 @@ url: "{{ item.url }}" dest: "{{ tomcat_webapps_path }}/{{ item.name }}" mode: 0755 - validate_certs: no + validate_certs: false owner: "{{ tomcat_user }}" group: "{{ tomcat_group }}" with_items: "{{ tomcat_war_to_deploy_urls }}" diff --git a/tasks/install.yml b/tasks/install.yml index c3a6732..19c68e2 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -36,7 +36,7 @@ unarchive: extra_opts: ['--strip-components=1'] src: "{{ tomcat_url }}" - remote_src: yes + remote_src: true dest: "{{ tomcat_install_path }}" owner: "{{ tomcat_user }}" group: "{{ tomcat_group }}" diff --git a/tasks/service.yml b/tasks/service.yml index 6cb1aca..9c3c456 100644 --- a/tasks/service.yml +++ b/tasks/service.yml @@ -5,4 +5,4 @@ name: tomcat state: "{{ tomcat_service_state }}" enabled: "{{ tomcat_service_enabled }}" - daemon_reload: yes + daemon_reload: true diff --git a/test-requirements.txt b/test-requirements.txt index fb1f37d..89cdf3f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,6 @@ -molecule==2.10.0 -docker-py +ansible==2.8.6 +molecule==3.0.4 +docker==4.1.0 +jmespath==0.9.4 +lxml==4.5.0 +ansible-lint==4.2.0 From a8137b5938ed4dcfe256249baa8d0d4883d39e3b Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Thu, 7 May 2020 19:19:19 +0200 Subject: [PATCH 02/18] [#61] Update to molecule 3.x. Updated Readme and meta with correct ansible version --- README.md | 8 +++----- meta/main.yml | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 47ba7f9..ef04402 100644 --- a/README.md +++ b/README.md @@ -84,11 +84,9 @@ See molecule/molecule.yml to check possible testing platforms. ## Works With -![Ansible](https://img.shields.io/badge/ansible-2.4.0.0-green.svg) -![Ansible](https://img.shields.io/badge/ansible-2.5.0.0-green.svg) -![Ansible](https://img.shields.io/badge/ansible-2.6.2.0-green.svg) -![Molecule](https://img.shields.io/badge/molecule-2.10.0-green.svg) -![Goss](https://img.shields.io/badge/goss-0.3.5-green.svg) +![Ansible](https://img.shields.io/badge/ansible-2.8.6-green.svg) +![Molecule](https://img.shields.io/badge/molecule-3.0.4-green.svg) +![Goss](https://img.shields.io/badge/goss-0.3-11-green.svg) ## Versioning diff --git a/meta/main.yml b/meta/main.yml index b5b1252..193863e 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -2,7 +2,7 @@ galaxy_info: company: Idealista S.A.U. description: Tomcat role - min_ansible_version: 2.4.0.0 + min_ansible_version: 2.8 license: Apache 2.0 author: idealista platforms: From afe5a05fc5650adecff8a8120415f6f9077f1ddf Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Thu, 7 May 2020 19:22:01 +0200 Subject: [PATCH 03/18] [#61] Update to molecule 3.x. Pipfiles updated :) --- .gitignore | 3 +- Pipfile | 17 ++ Pipfile.lock | 542 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 560 insertions(+), 2 deletions(-) create mode 100644 Pipfile create mode 100644 Pipfile.lock diff --git a/.gitignore b/.gitignore index 4a753b6..dc5a557 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,4 @@ tests/__pycache__ tests/roles *.iml .idea/ -Pipfile -Pipfile.lock + diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..485f64e --- /dev/null +++ b/Pipfile @@ -0,0 +1,17 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +ansible = "==2.8.6" +molecule = "==3.0.4" +docker = "==4.1.0" +jmespath = "==0.9.4" +lxml = "==4.5.0" +ansible-lint = "==4.2.0" + +[requires] +python_version = "3" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..64007c3 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,542 @@ +{ + "_meta": { + "hash": { + "sha256": "42735149ab93085a1b04468f683187a2d7f9193c9e829bc5d846bce39989d6ca" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "ansible": { + "hashes": [ + "sha256:31203b27c9d61123e8c86b6eb5116a21859ed4f26d55a1a71eaf27bd92bce355" + ], + "index": "pypi", + "version": "==2.8.6" + }, + "ansible-lint": { + "hashes": [ + "sha256:b9fc9a6564f5d60a4284497f966f38ef78f0e2505edbe2bd1225f1ade31c2d8a", + "sha256:eb925d8682d70563ccb80e2aca7b3edf84fb0b768cea3edc6846aac7abdc414a" + ], + "index": "pypi", + "version": "==4.2.0" + }, + "arrow": { + "hashes": [ + "sha256:a24c1de90850f6fb2033fd6bf8a11f281e84cb54825e5eabdda219e673b52aac", + "sha256:eb5d339f00072cc297d7de252a2e75f272085d1231a3723f1026d1fa91367118" + ], + "version": "==0.15.6" + }, + "bcrypt": { + "hashes": [ + "sha256:0258f143f3de96b7c14f762c770f5fc56ccd72f8a1857a451c1cd9a655d9ac89", + "sha256:0b0069c752ec14172c5f78208f1863d7ad6755a6fae6fe76ec2c80d13be41e42", + "sha256:19a4b72a6ae5bb467fea018b825f0a7d917789bcfe893e53f15c92805d187294", + "sha256:5432dd7b34107ae8ed6c10a71b4397f1c853bd39a4d6ffa7e35f40584cffd161", + "sha256:6305557019906466fc42dbc53b46da004e72fd7a551c044a827e572c82191752", + "sha256:69361315039878c0680be456640f8705d76cb4a3a3fe1e057e0f261b74be4b31", + "sha256:6fe49a60b25b584e2f4ef175b29d3a83ba63b3a4df1b4c0605b826668d1b6be5", + "sha256:74a015102e877d0ccd02cdeaa18b32aa7273746914a6c5d0456dd442cb65b99c", + "sha256:763669a367869786bb4c8fcf731f4175775a5b43f070f50f46f0b59da45375d0", + "sha256:8b10acde4e1919d6015e1df86d4c217d3b5b01bb7744c36113ea43d529e1c3de", + "sha256:9fe92406c857409b70a38729dbdf6578caf9228de0aef5bc44f859ffe971a39e", + "sha256:a190f2a5dbbdbff4b74e3103cef44344bc30e61255beb27310e2aec407766052", + "sha256:a595c12c618119255c90deb4b046e1ca3bcfad64667c43d1166f2b04bc72db09", + "sha256:c9457fa5c121e94a58d6505cadca8bed1c64444b83b3204928a866ca2e599105", + "sha256:cb93f6b2ab0f6853550b74e051d297c27a638719753eb9ff66d1e4072be67133", + "sha256:ce4e4f0deb51d38b1611a27f330426154f2980e66582dc5f438aad38b5f24fc1", + "sha256:d7bdc26475679dd073ba0ed2766445bb5b20ca4793ca0db32b399dccc6bc84b7", + "sha256:ff032765bb8716d9387fd5376d987a937254b0619eff0972779515b5c98820bc" + ], + "version": "==3.1.7" + }, + "binaryornot": { + "hashes": [ + "sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061", + "sha256:b8b71173c917bddcd2c16070412e369c3ed7f0528926f70cac18a6c97fd563e4" + ], + "version": "==0.4.4" + }, + "cerberus": { + "hashes": [ + "sha256:302e6694f206dd85cb63f13fd5025b31ab6d38c99c50c6d769f8fa0b0f299589" + ], + "version": "==1.3.2" + }, + "certifi": { + "hashes": [ + "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304", + "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519" + ], + "version": "==2020.4.5.1" + }, + "cffi": { + "hashes": [ + "sha256:001bf3242a1bb04d985d63e138230802c6c8d4db3668fb545fb5005ddf5bb5ff", + "sha256:00789914be39dffba161cfc5be31b55775de5ba2235fe49aa28c148236c4e06b", + "sha256:028a579fc9aed3af38f4892bdcc7390508adabc30c6af4a6e4f611b0c680e6ac", + "sha256:14491a910663bf9f13ddf2bc8f60562d6bc5315c1f09c704937ef17293fb85b0", + "sha256:1cae98a7054b5c9391eb3249b86e0e99ab1e02bb0cc0575da191aedadbdf4384", + "sha256:2089ed025da3919d2e75a4d963d008330c96751127dd6f73c8dc0c65041b4c26", + "sha256:2d384f4a127a15ba701207f7639d94106693b6cd64173d6c8988e2c25f3ac2b6", + "sha256:337d448e5a725bba2d8293c48d9353fc68d0e9e4088d62a9571def317797522b", + "sha256:399aed636c7d3749bbed55bc907c3288cb43c65c4389964ad5ff849b6370603e", + "sha256:3b911c2dbd4f423b4c4fcca138cadde747abdb20d196c4a48708b8a2d32b16dd", + "sha256:3d311bcc4a41408cf5854f06ef2c5cab88f9fded37a3b95936c9879c1640d4c2", + "sha256:62ae9af2d069ea2698bf536dcfe1e4eed9090211dbaafeeedf5cb6c41b352f66", + "sha256:66e41db66b47d0d8672d8ed2708ba91b2f2524ece3dee48b5dfb36be8c2f21dc", + "sha256:675686925a9fb403edba0114db74e741d8181683dcf216be697d208857e04ca8", + "sha256:7e63cbcf2429a8dbfe48dcc2322d5f2220b77b2e17b7ba023d6166d84655da55", + "sha256:8a6c688fefb4e1cd56feb6c511984a6c4f7ec7d2a1ff31a10254f3c817054ae4", + "sha256:8c0ffc886aea5df6a1762d0019e9cb05f825d0eec1f520c51be9d198701daee5", + "sha256:95cd16d3dee553f882540c1ffe331d085c9e629499ceadfbda4d4fde635f4b7d", + "sha256:99f748a7e71ff382613b4e1acc0ac83bf7ad167fb3802e35e90d9763daba4d78", + "sha256:b8c78301cefcf5fd914aad35d3c04c2b21ce8629b5e4f4e45ae6812e461910fa", + "sha256:c420917b188a5582a56d8b93bdd8e0f6eca08c84ff623a4c16e809152cd35793", + "sha256:c43866529f2f06fe0edc6246eb4faa34f03fe88b64a0a9a942561c8e22f4b71f", + "sha256:cab50b8c2250b46fe738c77dbd25ce017d5e6fb35d3407606e7a4180656a5a6a", + "sha256:cef128cb4d5e0b3493f058f10ce32365972c554572ff821e175dbc6f8ff6924f", + "sha256:cf16e3cf6c0a5fdd9bc10c21687e19d29ad1fe863372b5543deaec1039581a30", + "sha256:e56c744aa6ff427a607763346e4170629caf7e48ead6921745986db3692f987f", + "sha256:e577934fc5f8779c554639376beeaa5657d54349096ef24abe8c74c5d9c117c3", + "sha256:f2b0fa0c01d8a0c7483afd9f31d7ecf2d71760ca24499c8697aeb5ca37dc090c" + ], + "version": "==1.14.0" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "click": { + "hashes": [ + "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", + "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc" + ], + "version": "==7.1.2" + }, + "click-completion": { + "hashes": [ + "sha256:5bf816b81367e638a190b6e91b50779007d14301b3f9f3145d68e3cade7bce86" + ], + "version": "==0.5.2" + }, + "click-help-colors": { + "hashes": [ + "sha256:0d841a4058ec88c47f93ff6f32547a055f8e0a0273f6bd6cb3e08430f195131d", + "sha256:119e5faf69cfc919c995c5962326ac8fd87f11e56a371af594e3dfd8458f4c6e" + ], + "version": "==0.8" + }, + "colorama": { + "hashes": [ + "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff", + "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1" + ], + "version": "==0.4.3" + }, + "cookiecutter": { + "hashes": [ + "sha256:430eb882d028afb6102c084bab6cf41f6559a77ce9b18dc6802e3bc0cc5f4a30", + "sha256:efb6b2d4780feda8908a873e38f0e61778c23f6a2ea58215723bcceb5b515dac" + ], + "version": "==1.7.2" + }, + "cryptography": { + "hashes": [ + "sha256:091d31c42f444c6f519485ed528d8b451d1a0c7bf30e8ca583a0cac44b8a0df6", + "sha256:18452582a3c85b96014b45686af264563e3e5d99d226589f057ace56196ec78b", + "sha256:1dfa985f62b137909496e7fc182dac687206d8d089dd03eaeb28ae16eec8e7d5", + "sha256:1e4014639d3d73fbc5ceff206049c5a9a849cefd106a49fa7aaaa25cc0ce35cf", + "sha256:22e91636a51170df0ae4dcbd250d318fd28c9f491c4e50b625a49964b24fe46e", + "sha256:3b3eba865ea2754738616f87292b7f29448aec342a7c720956f8083d252bf28b", + "sha256:651448cd2e3a6bc2bb76c3663785133c40d5e1a8c1a9c5429e4354201c6024ae", + "sha256:726086c17f94747cedbee6efa77e99ae170caebeb1116353c6cf0ab67ea6829b", + "sha256:844a76bc04472e5135b909da6aed84360f522ff5dfa47f93e3dd2a0b84a89fa0", + "sha256:88c881dd5a147e08d1bdcf2315c04972381d026cdb803325c03fe2b4a8ed858b", + "sha256:96c080ae7118c10fcbe6229ab43eb8b090fccd31a09ef55f83f690d1ef619a1d", + "sha256:a0c30272fb4ddda5f5ffc1089d7405b7a71b0b0f51993cb4e5dbb4590b2fc229", + "sha256:bb1f0281887d89617b4c68e8db9a2c42b9efebf2702a3c5bf70599421a8623e3", + "sha256:c447cf087cf2dbddc1add6987bbe2f767ed5317adb2d08af940db517dd704365", + "sha256:c4fd17d92e9d55b84707f4fd09992081ba872d1a0c610c109c18e062e06a2e55", + "sha256:d0d5aeaedd29be304848f1c5059074a740fa9f6f26b84c5b63e8b29e73dfc270", + "sha256:daf54a4b07d67ad437ff239c8a4080cfd1cc7213df57d33c97de7b4738048d5e", + "sha256:e993468c859d084d5579e2ebee101de8f5a27ce8e2159959b6673b418fd8c785", + "sha256:f118a95c7480f5be0df8afeb9a11bd199aa20afab7a96bcf20409b411a3a85f0" + ], + "version": "==2.9.2" + }, + "docker": { + "hashes": [ + "sha256:6e06c5e70ba4fad73e35f00c55a895a448398f3ada7faae072e2bb01348bafc1", + "sha256:8f93775b8bdae3a2df6bc9a5312cce564cade58d6555f2c2570165a1270cd8a7" + ], + "index": "pypi", + "version": "==4.1.0" + }, + "fasteners": { + "hashes": [ + "sha256:007e4d2b2d4a10093f67e932e5166722d2eab83b77724156e92ad013c6226574", + "sha256:3a176da6b70df9bb88498e1a18a9e4a8579ed5b9141207762368a1017bf8f5ef" + ], + "version": "==0.15" + }, + "idna": { + "hashes": [ + "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb", + "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa" + ], + "version": "==2.9" + }, + "importlib-metadata": { + "hashes": [ + "sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f", + "sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e" + ], + "markers": "python_version < '3.8'", + "version": "==1.6.0" + }, + "jinja2": { + "hashes": [ + "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0", + "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035" + ], + "version": "==2.11.2" + }, + "jinja2-time": { + "hashes": [ + "sha256:d14eaa4d315e7688daa4969f616f226614350c48730bfa1692d2caebd8c90d40", + "sha256:d3eab6605e3ec8b7a0863df09cc1d23714908fa61aa6986a845c20ba488b4efa" + ], + "version": "==0.2.0" + }, + "jmespath": { + "hashes": [ + "sha256:3720a4b1bd659dd2eecad0666459b9788813e032b83e7ba58578e48254e0a0e6", + "sha256:bde2aef6f44302dfb30320115b17d030798de8c4110e28d5cf6cf91a7a31074c" + ], + "index": "pypi", + "version": "==0.9.4" + }, + "lxml": { + "hashes": [ + "sha256:06d4e0bbb1d62e38ae6118406d7cdb4693a3fa34ee3762238bcb96c9e36a93cd", + "sha256:0701f7965903a1c3f6f09328c1278ac0eee8f56f244e66af79cb224b7ef3801c", + "sha256:1f2c4ec372bf1c4a2c7e4bb20845e8bcf8050365189d86806bad1e3ae473d081", + "sha256:4235bc124fdcf611d02047d7034164897ade13046bda967768836629bc62784f", + "sha256:5828c7f3e615f3975d48f40d4fe66e8a7b25f16b5e5705ffe1d22e43fb1f6261", + "sha256:585c0869f75577ac7a8ff38d08f7aac9033da2c41c11352ebf86a04652758b7a", + "sha256:5d467ce9c5d35b3bcc7172c06320dddb275fea6ac2037f72f0a4d7472035cea9", + "sha256:63dbc21efd7e822c11d5ddbedbbb08cd11a41e0032e382a0fd59b0b08e405a3a", + "sha256:7bc1b221e7867f2e7ff1933165c0cec7153dce93d0cdba6554b42a8beb687bdb", + "sha256:8620ce80f50d023d414183bf90cc2576c2837b88e00bea3f33ad2630133bbb60", + "sha256:8a0ebda56ebca1a83eb2d1ac266649b80af8dd4b4a3502b2c1e09ac2f88fe128", + "sha256:90ed0e36455a81b25b7034038e40880189169c308a3df360861ad74da7b68c1a", + "sha256:95e67224815ef86924fbc2b71a9dbd1f7262384bca4bc4793645794ac4200717", + "sha256:afdb34b715daf814d1abea0317b6d672476b498472f1e5aacbadc34ebbc26e89", + "sha256:b4b2c63cc7963aedd08a5f5a454c9f67251b1ac9e22fd9d72836206c42dc2a72", + "sha256:d068f55bda3c2c3fcaec24bd083d9e2eede32c583faf084d6e4b9daaea77dde8", + "sha256:d5b3c4b7edd2e770375a01139be11307f04341ec709cf724e0f26ebb1eef12c3", + "sha256:deadf4df349d1dcd7b2853a2c8796593cc346600726eff680ed8ed11812382a7", + "sha256:df533af6f88080419c5a604d0d63b2c33b1c0c4409aba7d0cb6de305147ea8c8", + "sha256:e4aa948eb15018a657702fee0b9db47e908491c64d36b4a90f59a64741516e77", + "sha256:e5d842c73e4ef6ed8c1bd77806bf84a7cb535f9c0cf9b2c74d02ebda310070e1", + "sha256:ebec08091a22c2be870890913bdadd86fcd8e9f0f22bcb398abd3af914690c15", + "sha256:edc15fcfd77395e24543be48871c251f38132bb834d9fdfdad756adb6ea37679", + "sha256:f2b74784ed7e0bc2d02bd53e48ad6ba523c9b36c194260b7a5045071abbb1012", + "sha256:fa071559f14bd1e92077b1b5f6c22cf09756c6de7139370249eb372854ce51e6", + "sha256:fd52e796fee7171c4361d441796b64df1acfceb51f29e545e812f16d023c4bbc", + "sha256:fe976a0f1ef09b3638778024ab9fb8cde3118f203364212c198f71341c0715ca" + ], + "index": "pypi", + "version": "==4.5.0" + }, + "markupsafe": { + "hashes": [ + "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", + "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", + "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", + "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", + "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", + "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", + "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", + "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", + "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", + "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", + "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", + "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", + "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", + "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", + "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", + "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", + "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", + "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", + "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", + "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", + "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", + "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", + "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", + "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", + "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", + "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", + "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", + "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2", + "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", + "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be" + ], + "version": "==1.1.1" + }, + "molecule": { + "hashes": [ + "sha256:29137de659d45ecdef28d107c0dc7e85ab3d5e37d5d17813430a7cc15be5b02e", + "sha256:b4f556495a0b8955ca4ac2f86b9a675b26b6adcba93206efd325a5b61d90548f" + ], + "index": "pypi", + "version": "==3.0.4" + }, + "monotonic": { + "hashes": [ + "sha256:23953d55076df038541e648a53676fb24980f7a1be290cdda21300b3bc21dfb0", + "sha256:552a91f381532e33cbd07c6a2655a21908088962bb8fa7239ecbcc6ad1140cc7" + ], + "version": "==1.5" + }, + "paramiko": { + "hashes": [ + "sha256:920492895db8013f6cc0179293147f830b8c7b21fdfc839b6bad760c27459d9f", + "sha256:9c980875fa4d2cb751604664e9a2d0f69096643f5be4db1b99599fe114a97b2f" + ], + "version": "==2.7.1" + }, + "pathspec": { + "hashes": [ + "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0", + "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061" + ], + "version": "==0.8.0" + }, + "pexpect": { + "hashes": [ + "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937", + "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c" + ], + "version": "==4.8.0" + }, + "pluggy": { + "hashes": [ + "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", + "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d" + ], + "version": "==0.13.1" + }, + "poyo": { + "hashes": [ + "sha256:3e2ca8e33fdc3c411cd101ca395668395dd5dc7ac775b8e809e3def9f9fe041a", + "sha256:e26956aa780c45f011ca9886f044590e2d8fd8b61db7b1c1cf4e0869f48ed4dd" + ], + "version": "==0.5.0" + }, + "ptyprocess": { + "hashes": [ + "sha256:923f299cc5ad920c68f2bc0bc98b75b9f838b93b599941a6b63ddbc2476394c0", + "sha256:d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f" + ], + "version": "==0.6.0" + }, + "pycparser": { + "hashes": [ + "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0", + "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705" + ], + "version": "==2.20" + }, + "pynacl": { + "hashes": [ + "sha256:05c26f93964373fc0abe332676cb6735f0ecad27711035b9472751faa8521255", + "sha256:0c6100edd16fefd1557da078c7a31e7b7d7a52ce39fdca2bec29d4f7b6e7600c", + "sha256:0d0a8171a68edf51add1e73d2159c4bc19fc0718e79dec51166e940856c2f28e", + "sha256:1c780712b206317a746ace34c209b8c29dbfd841dfbc02aa27f2084dd3db77ae", + "sha256:2424c8b9f41aa65bbdbd7a64e73a7450ebb4aa9ddedc6a081e7afcc4c97f7621", + "sha256:2d23c04e8d709444220557ae48ed01f3f1086439f12dbf11976e849a4926db56", + "sha256:30f36a9c70450c7878053fa1344aca0145fd47d845270b43a7ee9192a051bf39", + "sha256:37aa336a317209f1bb099ad177fef0da45be36a2aa664507c5d72015f956c310", + "sha256:4943decfc5b905748f0756fdd99d4f9498d7064815c4cf3643820c9028b711d1", + "sha256:53126cd91356342dcae7e209f840212a58dcf1177ad52c1d938d428eebc9fee5", + "sha256:57ef38a65056e7800859e5ba9e6091053cd06e1038983016effaffe0efcd594a", + "sha256:5bd61e9b44c543016ce1f6aef48606280e45f892a928ca7068fba30021e9b786", + "sha256:6482d3017a0c0327a49dddc8bd1074cc730d45db2ccb09c3bac1f8f32d1eb61b", + "sha256:7d3ce02c0784b7cbcc771a2da6ea51f87e8716004512493a2b69016326301c3b", + "sha256:a14e499c0f5955dcc3991f785f3f8e2130ed504fa3a7f44009ff458ad6bdd17f", + "sha256:a39f54ccbcd2757d1d63b0ec00a00980c0b382c62865b61a505163943624ab20", + "sha256:aabb0c5232910a20eec8563503c153a8e78bbf5459490c49ab31f6adf3f3a415", + "sha256:bd4ecb473a96ad0f90c20acba4f0bf0df91a4e03a1f4dd6a4bdc9ca75aa3a715", + "sha256:bf459128feb543cfca16a95f8da31e2e65e4c5257d2f3dfa8c0c1031139c9c92", + "sha256:e2da3c13307eac601f3de04887624939aca8ee3c9488a0bb0eca4fb9401fc6b1", + "sha256:f67814c38162f4deb31f68d590771a29d5ae3b1bd64b75cf232308e5c74777e0" + ], + "version": "==1.3.0" + }, + "python-dateutil": { + "hashes": [ + "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c", + "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a" + ], + "version": "==2.8.1" + }, + "python-gilt": { + "hashes": [ + "sha256:e220ea2e7e190ee06dbfa5fafe87967858b4ac0cf53f3072fa6ece4664a42082" + ], + "version": "==1.2.3" + }, + "python-slugify": { + "hashes": [ + "sha256:a8fc3433821140e8f409a9831d13ae5deccd0b033d4744d94b31fea141bdd84c" + ], + "version": "==4.0.0" + }, + "pyyaml": { + "hashes": [ + "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97", + "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76", + "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2", + "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648", + "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf", + "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f", + "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2", + "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee", + "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d", + "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c", + "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a" + ], + "version": "==5.3.1" + }, + "requests": { + "hashes": [ + "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee", + "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6" + ], + "version": "==2.23.0" + }, + "ruamel.yaml": { + "hashes": [ + "sha256:0962fd7999e064c4865f96fb1e23079075f4a2a14849bcdc5cdba53a24f9759b", + "sha256:099c644a778bf72ffa00524f78dd0b6476bca94a1da344130f4bf3381ce5b954" + ], + "markers": "python_version >= '3.7'", + "version": "==0.16.10" + }, + "ruamel.yaml.clib": { + "hashes": [ + "sha256:1e77424825caba5553bbade750cec2277ef130647d685c2b38f68bc03453bac6", + "sha256:392b7c371312abf27fb549ec2d5e0092f7ef6e6c9f767bfb13e83cb903aca0fd", + "sha256:4d55386129291b96483edcb93b381470f7cd69f97585829b048a3d758d31210a", + "sha256:550168c02d8de52ee58c3d8a8193d5a8a9491a5e7b2462d27ac5bf63717574c9", + "sha256:57933a6986a3036257ad7bf283529e7c19c2810ff24c86f4a0cfeb49d2099919", + "sha256:615b0396a7fad02d1f9a0dcf9f01202bf9caefee6265198f252c865f4227fcc6", + "sha256:77556a7aa190be9a2bd83b7ee075d3df5f3c5016d395613671487e79b082d784", + "sha256:7aee724e1ff424757b5bd8f6c5bbdb033a570b2b4683b17ace4dbe61a99a657b", + "sha256:8073c8b92b06b572e4057b583c3d01674ceaf32167801fe545a087d7a1e8bf52", + "sha256:9c6d040d0396c28d3eaaa6cb20152cb3b2f15adf35a0304f4f40a3cf9f1d2448", + "sha256:a0ff786d2a7dbe55f9544b3f6ebbcc495d7e730df92a08434604f6f470b899c5", + "sha256:b1b7fcee6aedcdc7e62c3a73f238b3d080c7ba6650cd808bce8d7761ec484070", + "sha256:b66832ea8077d9b3f6e311c4a53d06273db5dc2db6e8a908550f3c14d67e718c", + "sha256:be018933c2f4ee7de55e7bd7d0d801b3dfb09d21dad0cce8a97995fd3e44be30", + "sha256:d0d3ac228c9bbab08134b4004d748cf9f8743504875b3603b3afbb97e3472947", + "sha256:d10e9dd744cf85c219bf747c75194b624cc7a94f0c80ead624b06bfa9f61d3bc", + "sha256:ea4362548ee0cbc266949d8a441238d9ad3600ca9910c3fe4e82ee3a50706973", + "sha256:ed5b3698a2bb241b7f5cbbe277eaa7fe48b07a58784fba4f75224fd066d253ad", + "sha256:f9dcc1ae73f36e8059589b601e8e4776b9976effd76c21ad6a855a74318efd6e" + ], + "markers": "platform_python_implementation == 'CPython' and python_version < '3.9'", + "version": "==0.2.0" + }, + "sh": { + "hashes": [ + "sha256:ae3258c5249493cebe73cb4e18253a41ed69262484bad36fdb3efcb8ad8870bb", + "sha256:b52bf5833ed01c7b5c5fb73a7f71b3d98d48e9b9b8764236237bdc7ecae850fc" + ], + "version": "==1.12.14" + }, + "shellingham": { + "hashes": [ + "sha256:576c1982bea0ba82fb46c36feb951319d7f42214a82634233f58b40d858a751e", + "sha256:7f6206ae169dc1a03af8a138681b3f962ae61cc93ade84d0585cca3aaf770044" + ], + "version": "==1.3.2" + }, + "six": { + "hashes": [ + "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a", + "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c" + ], + "version": "==1.14.0" + }, + "tabulate": { + "hashes": [ + "sha256:ac64cb76d53b1231d364babcd72abbb16855adac7de6665122f97b593f1eb2ba", + "sha256:db2723a20d04bcda8522165c73eea7c300eda74e0ce852d9022e0159d7895007" + ], + "version": "==0.8.7" + }, + "text-unidecode": { + "hashes": [ + "sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8", + "sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93" + ], + "version": "==1.3" + }, + "tree-format": { + "hashes": [ + "sha256:a538523aa78ae7a4b10003b04f3e1b37708e0e089d99c9d3b9e1c71384c9a7f9", + "sha256:b5056228dbedde1fb81b79f71fb0c23c98e9d365230df9b29af76e8d8003de11" + ], + "version": "==0.1.2" + }, + "urllib3": { + "hashes": [ + "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527", + "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115" + ], + "version": "==1.25.9" + }, + "websocket-client": { + "hashes": [ + "sha256:0fc45c961324d79c781bab301359d5a1b00b13ad1b10415a4780229ef71a5549", + "sha256:d735b91d6d1692a6a181f2a8c9e0238e5f6373356f561bb9dc4c7af36f452010" + ], + "version": "==0.57.0" + }, + "yamllint": { + "hashes": [ + "sha256:0fa69bf8a86182b7fe14918bdd3a30354c869966bbc7cbfff176af71bda9c806", + "sha256:59f3ff77f44e7f46be6aecdb985830f73a1c51e290b7082a7d38c2ae1940f4a9" + ], + "version": "==1.23.0" + }, + "zipp": { + "hashes": [ + "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b", + "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96" + ], + "version": "==3.1.0" + } + }, + "develop": {} +} From 17ed5f4cdf052dd6273da58bb44124bca5d5ccd1 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Thu, 7 May 2020 20:44:16 +0200 Subject: [PATCH 04/18] [#61] Update to molecule 3.x. Removed scenarios in molecule. Updated readme. --- README.md | 6 ++- molecule/agent/Dockerfile.j2 | 19 ------- molecule/agent/converge.yml | 6 --- molecule/agent/molecule.yml | 31 ------------ .../tomcat/conf/test/test_template.xml.j2 | 2 - molecule/agent/tests/test_agent.yml | 33 ------------ molecule/agent/verify.yml | 50 ------------------- molecule/change-log-path/Dockerfile.j2 | 19 ------- molecule/change-log-path/converge.yml | 6 --- .../group_vars/tomcat/main.yml | 3 -- molecule/change-log-path/molecule.yml | 31 ------------ .../change-log-path/tests/test_tomcat.yml | 30 ----------- molecule/change-log-path/verify.yml | 50 ------------------- molecule/default/Dockerfile.j2 | 3 -- .../files/tomcat/conf/test/test_file.xml | 1 - .../group_vars/tomcat/main.yml | 2 + .../tomcat/agents/newrelic/newrelic.yml.j2 | 0 molecule/default/tests/test_tomcat.yml | 22 +++++++- 18 files changed, 27 insertions(+), 287 deletions(-) delete mode 100644 molecule/agent/Dockerfile.j2 delete mode 100644 molecule/agent/converge.yml delete mode 100644 molecule/agent/molecule.yml delete mode 100644 molecule/agent/templates/tomcat/conf/test/test_template.xml.j2 delete mode 100644 molecule/agent/tests/test_agent.yml delete mode 100644 molecule/agent/verify.yml delete mode 100644 molecule/change-log-path/Dockerfile.j2 delete mode 100644 molecule/change-log-path/converge.yml delete mode 100644 molecule/change-log-path/group_vars/tomcat/main.yml delete mode 100644 molecule/change-log-path/molecule.yml delete mode 100644 molecule/change-log-path/tests/test_tomcat.yml delete mode 100644 molecule/change-log-path/verify.yml delete mode 100644 molecule/default/files/tomcat/conf/test/test_file.xml rename molecule/{agent => default}/group_vars/tomcat/main.yml (92%) rename molecule/{agent => default}/templates/tomcat/agents/newrelic/newrelic.yml.j2 (100%) diff --git a/README.md b/README.md index ef04402..38b4a7a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ![Logo](https://raw.githubusercontent.com/idealista/tomcat-role/master/logo.gif) [![Build Status](https://travis-ci.org/idealista/tomcat-role.svg?branch=master)](https://travis-ci.org/idealista/tomcat-role) +[![Ansible Galaxy](https://img.shields.io/badge/galaxy-idealista.tomcat__role-B62682.svg)](https://galaxy.ansible.com/idealista/tomcat_role) + # Tomcat Ansible role This ansible role installs a Tomcat server in a debian environment. @@ -26,6 +28,7 @@ For compatible Ansible versions check [.travis.yml](.travis.yml). Inventory destination should be a Debian environment. For testing purposes, [Molecule](https://molecule.readthedocs.io/) with Docker as driver and [Goss](http://goss.rocks) as verifier +We need a system with java previously installed, we recommend the use of our role for that purpose: [idealista.java-role](https://github.com/idealista/java_role) ### Installing @@ -69,7 +72,8 @@ Look to the defaults properties file to see the possible configuration propertie ### Install dependencies ```sh -pipenv install +pipenv sync +pipenv shell ``` For more information read the [pipenv docs](https://docs.pipenv.org/). diff --git a/molecule/agent/Dockerfile.j2 b/molecule/agent/Dockerfile.j2 deleted file mode 100644 index faef72e..0000000 --- a/molecule/agent/Dockerfile.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# Molecule managed - -{% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} -{% else %} -FROM {{ item.image }} -{% endif %} - -# install minimal packages for debian slim images -RUN apt-get update && \ - apt-get install -y python sudo bash ca-certificates iproute2 systemd systemd-sysv python-pip && \ - apt-get clean - -# https://github.com/moby/moby/issues/28614#issuecomment-310581026 -STOPSIGNAL SIGRTMIN+3 -RUN systemctl set-default multi-user.target - -# -RUN mkdir -p /usr/share/man/man1 diff --git a/molecule/agent/converge.yml b/molecule/agent/converge.yml deleted file mode 100644 index 35887a9..0000000 --- a/molecule/agent/converge.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- name: Converge - hosts: all - roles: - - role: tomcat-role diff --git a/molecule/agent/molecule.yml b/molecule/agent/molecule.yml deleted file mode 100644 index a4aecee..0000000 --- a/molecule/agent/molecule.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- - -dependency: - name: galaxy -driver: - name: docker -lint: | - yamllint . - ansible-lint . - -platforms: - - name: tomcat - groups: - - tomcat - image: idealista/jdk:8u222-stretch-openjdk-headless - privileged: false - command: '/lib/systemd/systemd' - capabilities: - - SYS_ADMIN - volumes: - - '/sys/fs/cgroup:/sys/fs/cgroup:ro' - tmpfs: - - '/run' - - '/run/lock' - - '/tmp' - -provisioner: - name: ansible -verifier: - name: ansible - directory: ./tests diff --git a/molecule/agent/templates/tomcat/conf/test/test_template.xml.j2 b/molecule/agent/templates/tomcat/conf/test/test_template.xml.j2 deleted file mode 100644 index 2fc3838..0000000 --- a/molecule/agent/templates/tomcat/conf/test/test_template.xml.j2 +++ /dev/null @@ -1,2 +0,0 @@ - -{{ tomcat_conf_path }} diff --git a/molecule/agent/tests/test_agent.yml b/molecule/agent/tests/test_agent.yml deleted file mode 100644 index 64b02ab..0000000 --- a/molecule/agent/tests/test_agent.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- - -service: - tomcat: - enabled: true - running: true - -user: - tomcat: - exists: true - groups: - - tomcat - -group: - tomcat: - exists: true - -port: - tcp:8080: - listening: true - -file: - /opt/tomcat/newrelic: - filetype: directory - exists: true - owner: tomcat - group: tomcat - /opt/tomcat/newrelic/newrelic.yml: - exists: true - /opt/tomcat/bin/setagentenv.sh: - exists: true - contains: - - '-javaagent:/opt/tomcat/newrelic/newrelic.jar' diff --git a/molecule/agent/verify.yml b/molecule/agent/verify.yml deleted file mode 100644 index 18be02a..0000000 --- a/molecule/agent/verify.yml +++ /dev/null @@ -1,50 +0,0 @@ ---- - -- name: Verify - hosts: all - become: true - vars: - goss_version: v0.3.11 - goss_arch: amd64 - goss_dst: /usr/local/bin/goss - goss_sha256sum: 7a751c102abac61fd8dff45f87f36c3732cb5158e1414ab78e6877864fc2f7a4 - goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" - goss_test_directory: /tmp - goss_format: documentation - tasks: - - name: Download and install Goss - get_url: - url: "{{ goss_url }}" - dest: "{{ goss_dst }}" - sha256sum: "{{ goss_sha256sum }}" - mode: 0755 - register: download_goss - until: download_goss is succeeded - retries: 3 - - - name: Copy Goss tests to remote - copy: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/{{ item | basename }}" - with_fileglob: - - "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml" - - - name: Register test files - shell: "ls {{ goss_test_directory }}/test_*.yml" - register: test_files - - - name: Execute Goss tests - command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}" - register: test_results - with_items: "{{ test_files.stdout_lines }}" - - - name: Display details about the Goss results - debug: - msg: "{{ item.stdout_lines }}" - with_items: "{{ test_results.results }}" - - - name: Fail when tests fail - fail: - msg: "Goss failed to validate" - when: item.rc != 0 - with_items: "{{ test_results.results }}" diff --git a/molecule/change-log-path/Dockerfile.j2 b/molecule/change-log-path/Dockerfile.j2 deleted file mode 100644 index faef72e..0000000 --- a/molecule/change-log-path/Dockerfile.j2 +++ /dev/null @@ -1,19 +0,0 @@ -# Molecule managed - -{% if item.registry is defined %} -FROM {{ item.registry.url }}/{{ item.image }} -{% else %} -FROM {{ item.image }} -{% endif %} - -# install minimal packages for debian slim images -RUN apt-get update && \ - apt-get install -y python sudo bash ca-certificates iproute2 systemd systemd-sysv python-pip && \ - apt-get clean - -# https://github.com/moby/moby/issues/28614#issuecomment-310581026 -STOPSIGNAL SIGRTMIN+3 -RUN systemctl set-default multi-user.target - -# -RUN mkdir -p /usr/share/man/man1 diff --git a/molecule/change-log-path/converge.yml b/molecule/change-log-path/converge.yml deleted file mode 100644 index 35887a9..0000000 --- a/molecule/change-log-path/converge.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -- name: Converge - hosts: all - roles: - - role: tomcat-role diff --git a/molecule/change-log-path/group_vars/tomcat/main.yml b/molecule/change-log-path/group_vars/tomcat/main.yml deleted file mode 100644 index d3de6b9..0000000 --- a/molecule/change-log-path/group_vars/tomcat/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - -tomcat_logs_path: /var/log/tomcat diff --git a/molecule/change-log-path/molecule.yml b/molecule/change-log-path/molecule.yml deleted file mode 100644 index a4aecee..0000000 --- a/molecule/change-log-path/molecule.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- - -dependency: - name: galaxy -driver: - name: docker -lint: | - yamllint . - ansible-lint . - -platforms: - - name: tomcat - groups: - - tomcat - image: idealista/jdk:8u222-stretch-openjdk-headless - privileged: false - command: '/lib/systemd/systemd' - capabilities: - - SYS_ADMIN - volumes: - - '/sys/fs/cgroup:/sys/fs/cgroup:ro' - tmpfs: - - '/run' - - '/run/lock' - - '/tmp' - -provisioner: - name: ansible -verifier: - name: ansible - directory: ./tests diff --git a/molecule/change-log-path/tests/test_tomcat.yml b/molecule/change-log-path/tests/test_tomcat.yml deleted file mode 100644 index 029c199..0000000 --- a/molecule/change-log-path/tests/test_tomcat.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- - -service: - tomcat: - enabled: true - running: true - -user: - tomcat: - exists: true - groups: - - tomcat - -group: - tomcat: - exists: true - -port: - tcp:8080: - listening: true - -file: - /var/log/tomcat: - filetype: directory - exists: true - owner: tomcat - group: tomcat - /var/log/tomcat/catalina.out: - exists: true - diff --git a/molecule/change-log-path/verify.yml b/molecule/change-log-path/verify.yml deleted file mode 100644 index 18be02a..0000000 --- a/molecule/change-log-path/verify.yml +++ /dev/null @@ -1,50 +0,0 @@ ---- - -- name: Verify - hosts: all - become: true - vars: - goss_version: v0.3.11 - goss_arch: amd64 - goss_dst: /usr/local/bin/goss - goss_sha256sum: 7a751c102abac61fd8dff45f87f36c3732cb5158e1414ab78e6877864fc2f7a4 - goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" - goss_test_directory: /tmp - goss_format: documentation - tasks: - - name: Download and install Goss - get_url: - url: "{{ goss_url }}" - dest: "{{ goss_dst }}" - sha256sum: "{{ goss_sha256sum }}" - mode: 0755 - register: download_goss - until: download_goss is succeeded - retries: 3 - - - name: Copy Goss tests to remote - copy: - src: "{{ item }}" - dest: "{{ goss_test_directory }}/{{ item | basename }}" - with_fileglob: - - "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_*.yml" - - - name: Register test files - shell: "ls {{ goss_test_directory }}/test_*.yml" - register: test_files - - - name: Execute Goss tests - command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}" - register: test_results - with_items: "{{ test_files.stdout_lines }}" - - - name: Display details about the Goss results - debug: - msg: "{{ item.stdout_lines }}" - with_items: "{{ test_results.results }}" - - - name: Fail when tests fail - fail: - msg: "Goss failed to validate" - when: item.rc != 0 - with_items: "{{ test_results.results }}" diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index faef72e..d0bdd6e 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -11,9 +11,6 @@ RUN apt-get update && \ apt-get install -y python sudo bash ca-certificates iproute2 systemd systemd-sysv python-pip && \ apt-get clean -# https://github.com/moby/moby/issues/28614#issuecomment-310581026 STOPSIGNAL SIGRTMIN+3 RUN systemctl set-default multi-user.target -# -RUN mkdir -p /usr/share/man/man1 diff --git a/molecule/default/files/tomcat/conf/test/test_file.xml b/molecule/default/files/tomcat/conf/test/test_file.xml deleted file mode 100644 index b4eb13f..0000000 --- a/molecule/default/files/tomcat/conf/test/test_file.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/molecule/agent/group_vars/tomcat/main.yml b/molecule/default/group_vars/tomcat/main.yml similarity index 92% rename from molecule/agent/group_vars/tomcat/main.yml rename to molecule/default/group_vars/tomcat/main.yml index 7135c1a..9cb7c5d 100644 --- a/molecule/agent/group_vars/tomcat/main.yml +++ b/molecule/default/group_vars/tomcat/main.yml @@ -15,3 +15,5 @@ tomcat_agents_config: application_name: "application_sample_name", license_key: "sddsasd" } + +tomcat_logs_path: /var/log/tomcat diff --git a/molecule/agent/templates/tomcat/agents/newrelic/newrelic.yml.j2 b/molecule/default/templates/tomcat/agents/newrelic/newrelic.yml.j2 similarity index 100% rename from molecule/agent/templates/tomcat/agents/newrelic/newrelic.yml.j2 rename to molecule/default/templates/tomcat/agents/newrelic/newrelic.yml.j2 diff --git a/molecule/default/tests/test_tomcat.yml b/molecule/default/tests/test_tomcat.yml index 3d3416c..f634c8c 100644 --- a/molecule/default/tests/test_tomcat.yml +++ b/molecule/default/tests/test_tomcat.yml @@ -22,7 +22,25 @@ port: listening: true file: - /opt/tomcat/webapps/docs: + /opt/tomcat/newrelic: + filetype: directory + exists: true + owner: tomcat + group: tomcat + /opt/tomcat/newrelic/newrelic.yml: + exists: true + /opt/tomcat/bin/setagentenv.sh: + exists: true + contains: + - '-javaagent:/opt/tomcat/newrelic/newrelic.jar' + /var/log/tomcat: + filetype: directory + exists: true + owner: tomcat + group: tomcat + /var/log/tomcat/catalina.out: + exists: true + /opt/tomcat/webapps/docs: exists: true /opt/tomcat/webapps/examples: exists: true @@ -43,4 +61,4 @@ command: java -cp /opt/tomcat/lib/catalina.jar org.apache.catalina.util.ServerInfo | grep 'Server version': exit-status: 0 stdout: - - "9.0.34" + - "9.0.34" \ No newline at end of file From 332f4bfdea716a40196868a4e0bd499228131eab Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Fri, 8 May 2020 07:45:45 +0200 Subject: [PATCH 05/18] [#61] Update to molecule 3.x. Fixed broken molecule test --- molecule/default/files/tomcat/conf/test/test_file.xml | 1 + molecule/default/tests/test_tomcat.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 molecule/default/files/tomcat/conf/test/test_file.xml diff --git a/molecule/default/files/tomcat/conf/test/test_file.xml b/molecule/default/files/tomcat/conf/test/test_file.xml new file mode 100644 index 0000000..b2a5caa --- /dev/null +++ b/molecule/default/files/tomcat/conf/test/test_file.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/molecule/default/tests/test_tomcat.yml b/molecule/default/tests/test_tomcat.yml index f634c8c..9d51c81 100644 --- a/molecule/default/tests/test_tomcat.yml +++ b/molecule/default/tests/test_tomcat.yml @@ -40,7 +40,7 @@ file: group: tomcat /var/log/tomcat/catalina.out: exists: true - /opt/tomcat/webapps/docs: + /opt/tomcat/webapps/docs: exists: true /opt/tomcat/webapps/examples: exists: true From 4547ee61a4d1f685209eaca987411c7fc35d7b8a Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Fri, 8 May 2020 08:34:13 +0200 Subject: [PATCH 06/18] [#61] Update to molecule 3.x. Checks for ajp port added --- molecule/default/tests/test_tomcat.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/molecule/default/tests/test_tomcat.yml b/molecule/default/tests/test_tomcat.yml index 9d51c81..5b3fbe0 100644 --- a/molecule/default/tests/test_tomcat.yml +++ b/molecule/default/tests/test_tomcat.yml @@ -20,6 +20,8 @@ port: listening: true tcp:8005: listening: true + tcp:8009: + listening: true file: /opt/tomcat/newrelic: From ceb85a60f2a48011ef1789a937f45ca9e9aa9ee8 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Fri, 8 May 2020 08:38:05 +0200 Subject: [PATCH 07/18] [#61] Update to molecule 3.x. Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38b4a7a..37ac26e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ For compatible Ansible versions check [.travis.yml](.travis.yml). Inventory destination should be a Debian environment. For testing purposes, [Molecule](https://molecule.readthedocs.io/) with Docker as driver and [Goss](http://goss.rocks) as verifier -We need a system with java previously installed, we recommend the use of our role for that purpose: [idealista.java-role](https://github.com/idealista/java_role) +This role needs a system with java previously installed. Its really recommended the use of idealista's java role for that purpose: [idealista.java-role](https://github.com/idealista/java_role) ### Installing From 2ddcbf9458244f23328bbb594a2b565bf013b8bd Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Thu, 14 May 2020 09:09:55 +0200 Subject: [PATCH 08/18] [#63] Rename role to tomcat_role --- CHANGELOG.md | 86 +++++++++++++++++------------------ README.md | 14 +++--- handlers/main.yml | 2 +- molecule/default/converge.yml | 2 +- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2202da9..fe3dc8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,76 +2,76 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). -## [Unreleased](https://github.com/idealista/tomcat-role/tree/develop) +## [Unreleased](https://github.com/idealista/tomcat_role/tree/develop) -## [1.8.0](https://github.com/idealista/tomcat-role/tree/1.8.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.7.0...1.8.0) +## [1.8.0](https://github.com/idealista/tomcat_role/tree/1.8.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.7.0...1.8.0) ### Added -- *[#56](https://github.com/idealista/tomcat-role/issues/56) Add Ansible 2.6 support for module maven_artifact* @jnogol +- *[#56](https://github.com/idealista/tomcat_role/issues/56) Add Ansible 2.6 support for module maven_artifact* @jnogol -## [1.7.0](https://github.com/idealista/tomcat-role/tree/1.7.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.6.2...1.7.0) +## [1.7.0](https://github.com/idealista/tomcat_role/tree/1.7.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.6.2...1.7.0) ### Changed -- *[#53](https://github.com/idealista/tomcat-role/issues/53) Allow the option to pass additional environment vars* @sorobon +- *[#53](https://github.com/idealista/tomcat_role/issues/53) Allow the option to pass additional environment vars* @sorobon - *Tomcat version to 8.5.31* @sorobon ### Fixed -- *[#4](https://github.com/idealista/tomcat-role/issues/4) Notify restart handler after new files copied/template* @sorobon +- *[#4](https://github.com/idealista/tomcat_role/issues/4) Notify restart handler after new files copied/template* @sorobon -## [1.6.2](https://github.com/idealista/tomcat-role/tree/1.6.2) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.6.1...1.6.2) +## [1.6.2](https://github.com/idealista/tomcat_role/tree/1.6.2) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.6.1...1.6.2) ### Changed -- *[#49](https://github.com/idealista/tomcat-role/issues/49) Updated tomcat version to 8.5.29* @sorobon +- *[#49](https://github.com/idealista/tomcat_role/issues/49) Updated tomcat version to 8.5.29* @sorobon -## [1.6.1](https://github.com/idealista/tomcat-role/tree/1.6.1) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.6.0...1.6.1) +## [1.6.1](https://github.com/idealista/tomcat_role/tree/1.6.1) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.6.0...1.6.1) ### Changed -- *[#46](https://github.com/idealista/tomcat-role/issues/46) Updated tomcat version to 8.5.28* @sorobon +- *[#46](https://github.com/idealista/tomcat_role/issues/46) Updated tomcat version to 8.5.28* @sorobon -## [1.6.0](https://github.com/idealista/tomcat-role/tree/1.6.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.5.0...1.6.0) +## [1.6.0](https://github.com/idealista/tomcat_role/tree/1.6.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.5.0...1.6.0) ### Added -- *[#43](https://github.com/idealista/tomcat-role/issues/43) Allow to change log files directory* @sorobon +- *[#43](https://github.com/idealista/tomcat_role/issues/43) Allow to change log files directory* @sorobon -## [1.5.0](https://github.com/idealista/tomcat-role/tree/1.5.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.4.0...1.5.0) +## [1.5.0](https://github.com/idealista/tomcat_role/tree/1.5.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.4.0...1.5.0) ### Added -- *[#40](https://github.com/idealista/tomcat-role/issues/40) Support for addons like java-agents* @sorobon +- *[#40](https://github.com/idealista/tomcat_role/issues/40) Support for addons like java-agents* @sorobon -## [1.4.0](https://github.com/idealista/tomcat-role/tree/1.4.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.3.1...1.4.0) +## [1.4.0](https://github.com/idealista/tomcat_role/tree/1.4.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.3.1...1.4.0) ### Added -- *[#29](https://github.com/idealista/tomcat-role/issues/29) Upgrade molecule* @jdvr -- *[#26](https://github.com/idealista/tomcat-role/issues/26) Fix to copy extra configuration recursively* @dortegau -- *[#24](https://github.com/idealista/tomcat-role/issues/24) Follow OWASP recommendations to protect Shutdown port* @dortegau -- *[#21](https://github.com/idealista/tomcat-role/issues/21) Remove pre-installed folders from webapps* @dortegau +- *[#29](https://github.com/idealista/tomcat_role/issues/29) Upgrade molecule* @jdvr +- *[#26](https://github.com/idealista/tomcat_role/issues/26) Fix to copy extra configuration recursively* @dortegau +- *[#24](https://github.com/idealista/tomcat_role/issues/24) Follow OWASP recommendations to protect Shutdown port* @dortegau +- *[#21](https://github.com/idealista/tomcat_role/issues/21) Remove pre-installed folders from webapps* @dortegau -## [1.3.1](https://github.com/idealista/tomcat-role/tree/1.3.1) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.3.0...1.3.1) +## [1.3.1](https://github.com/idealista/tomcat_role/tree/1.3.1) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.3.0...1.3.1) ### Fixed -- *[#17](https://github.com/idealista/tomcat-role/issues/17) Fix war user and group after download* @jdvr +- *[#17](https://github.com/idealista/tomcat_role/issues/17) Fix war user and group after download* @jdvr -## [1.3.0](https://github.com/idealista/tomcat-role/tree/1.3.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.2.0...1.3.0) +## [1.3.0](https://github.com/idealista/tomcat_role/tree/1.3.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.2.0...1.3.0) ### Added -- *[#13](https://github.com/idealista/tomcat-role/issues/13) Add maven repository as a valid download war source* @jdvr +- *[#13](https://github.com/idealista/tomcat_role/issues/13) Add maven repository as a valid download war source* @jdvr -## [1.2.0](https://github.com/idealista/tomcat-role/tree/1.2.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.1.2...1.2.0) +## [1.2.0](https://github.com/idealista/tomcat_role/tree/1.2.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.1.2...1.2.0) ### Added -- *[#5](https://github.com/idealista/tomcat-role/issues/5) Add a name for the downloaded war during deployment* @jdvr +- *[#5](https://github.com/idealista/tomcat_role/issues/5) Add a name for the downloaded war during deployment* @jdvr -## [1.1.2](https://github.com/idealista/tomcat-role/tree/1.1.2) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.1.0...1.1.2) +## [1.1.2](https://github.com/idealista/tomcat_role/tree/1.1.2) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.1.0...1.1.2) ### Fixed -- *[#8](https://github.com/idealista/tomcat-role/issues/8) Fix systemd startup* @jmonterrubio -- *[#6](https://github.com/idealista/tomcat-role/issues/6) Fix conf directory template copy* @jnogol +- *[#8](https://github.com/idealista/tomcat_role/issues/8) Fix systemd startup* @jmonterrubio +- *[#6](https://github.com/idealista/tomcat_role/issues/6) Fix conf directory template copy* @jnogol -## [1.1.0](https://github.com/idealista/tomcat-role/tree/1.1.0) -[Full Changelog](https://github.com/idealista/tomcat-role/compare/1.0.0...1.1.0) +## [1.1.0](https://github.com/idealista/tomcat_role/tree/1.1.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.0.0...1.1.0) ### Added -- *[#1](https://github.com/idealista/tomcat-role/issues/1) Add deploy task* @jdvr +- *[#1](https://github.com/idealista/tomcat_role/issues/1) Add deploy task* @jdvr -## [1.0.0](https://github.com/idealista/tomcat-role/tree/1.0.0) +## [1.0.0](https://github.com/idealista/tomcat_role/tree/1.0.0) ### Added - *First release* diff --git a/README.md b/README.md index 37ac26e..0f269a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -![Logo](https://raw.githubusercontent.com/idealista/tomcat-role/master/logo.gif) +![Logo](https://raw.githubusercontent.com/idealista/tomcat_role/master/logo.gif) -[![Build Status](https://travis-ci.org/idealista/tomcat-role.svg?branch=master)](https://travis-ci.org/idealista/tomcat-role) +[![Build Status](https://travis-ci.org/idealista/tomcat_role.svg?branch=master)](https://travis-ci.org/idealista/tomcat_role) [![Ansible Galaxy](https://img.shields.io/badge/galaxy-idealista.tomcat__role-B62682.svg)](https://galaxy.ansible.com/idealista/tomcat_role) # Tomcat Ansible role @@ -35,16 +35,16 @@ This role needs a system with java previously installed. Its really recommended Create or add to your roles dependency file (e.g requirements.yml) from GitHub: ``` -- src: http://github.com/idealista/tomcat-role.git +- src: http://github.com/idealista/tomcat_role.git scm: git version: 1.0.0 name: tomcat ``` -or using [Ansible Galaxy](https://galaxy.ansible.com/idealista/tomcat-role/) as origin if you prefer: +or using [Ansible Galaxy](https://galaxy.ansible.com/idealista/tomcat_role/) as origin if you prefer: ``` -- src: idealista.tomcat-role +- src: idealista.tomcat_role version: 1.0.0 name: tomcat ``` @@ -94,7 +94,7 @@ See molecule/molecule.yml to check possible testing platforms. ## Versioning -For the versions available, see the [tags on this repository](https://github.com/idealista/tomcat-role/tags). +For the versions available, see the [tags on this repository](https://github.com/idealista/tomcat_role/tags). Additionaly you can see what change in each version in the [CHANGELOG.md](CHANGELOG.md) file. @@ -102,7 +102,7 @@ Additionaly you can see what change in each version in the [CHANGELOG.md](CHANGE * **Idealista** - *Work with* - [idealista](https://github.com/idealista) -See also the list of [contributors](https://github.com/idealista/Tomcat-role/contributors) who participated in this project. +See also the list of [contributors](https://github.com/idealista/tomcat_role/contributors) who participated in this project. ## License diff --git a/handlers/main.yml b/handlers/main.yml index 6803127..bb39111 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,5 +1,5 @@ --- -# handlers file for tomcat-role +# handlers file for tomcat_role - name: restart tomcat systemd: diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 35887a9..b0a085c 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,4 +3,4 @@ - name: Converge hosts: all roles: - - role: tomcat-role + - role: tomcat_role From 63a96e6269a3facff99565aadc0b602329d14a29 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Thu, 14 May 2020 12:12:20 +0200 Subject: [PATCH 09/18] [#63] Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe3dc8f..2ff2fb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## [Unreleased](https://github.com/idealista/tomcat_role/tree/develop) +### Changed +- *[#61](https://github.com/idealista/tomcat_role/issues/61) Update molecule to 3.x* @sorobon +- *[#63](https://github.com/idealista/tomcat_role/issues/63) Rename role to tomcat_role* @sorobon ## [1.8.0](https://github.com/idealista/tomcat_role/tree/1.8.0) [Full Changelog](https://github.com/idealista/tomcat_role/compare/1.7.0...1.8.0) From 8262a1418db17828d6803e6363f7b21c414d28c4 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Thu, 14 May 2020 16:57:29 +0200 Subject: [PATCH 10/18] [#66] Improve agents management --- CHANGELOG.md | 1 + defaults/main.yml | 3 +- molecule/default/group_vars/tomcat/main.yml | 1 + tasks/agent.yml | 46 ++++++++++++++++----- templates/agents/version.txt.j2 | 1 + 5 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 templates/agents/version.txt.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ff2fb4..6731f5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch ### Changed - *[#61](https://github.com/idealista/tomcat_role/issues/61) Update molecule to 3.x* @sorobon - *[#63](https://github.com/idealista/tomcat_role/issues/63) Rename role to tomcat_role* @sorobon +- *[#66](https://github.com/idealista/tomcat_role/issues/66) Improve agents management* @sorobon ## [1.8.0](https://github.com/idealista/tomcat_role/tree/1.8.0) [Full Changelog](https://github.com/idealista/tomcat_role/compare/1.7.0...1.8.0) diff --git a/defaults/main.yml b/defaults/main.yml index 9fac430..041ae54 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -100,7 +100,7 @@ tomcat_default_log_logging_path: "${catalina.base}/logs" tomcat_default_log_valves: "logs" ## Agent configuration (optional) - +tomcat_agents_force_reinstall: false # tomcat_agents_required_libs: # - unzip # - apt-transport-https @@ -108,6 +108,7 @@ tomcat_default_log_valves: "logs" # tomcat_agents_config: # - name: "agent_name" # download_url: "download_url" +# version: "x.x.x" # catalina_opts: # - '-javaagent:{{ tomcat_install_path }}/agent_name/agent_file' # configuration_files: diff --git a/molecule/default/group_vars/tomcat/main.yml b/molecule/default/group_vars/tomcat/main.yml index 9cb7c5d..fafc50d 100644 --- a/molecule/default/group_vars/tomcat/main.yml +++ b/molecule/default/group_vars/tomcat/main.yml @@ -7,6 +7,7 @@ tomcat_agents_required_libs: tomcat_agents_config: - name: "newrelic" download_url: "http://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip" + version: "5.11.0" catalina_opts: - '-javaagent:{{ tomcat_install_path }}/newrelic/newrelic.jar' configuration_files: diff --git a/tasks/agent.yml b/tasks/agent.yml index e0b2deb..ffa9f64 100644 --- a/tasks/agent.yml +++ b/tasks/agent.yml @@ -1,12 +1,12 @@ --- -- name: Tomcat agent installation | Install required packages +- name: Tomcat | agent installation | Install required packages apt: pkg: "{{ item }}" state: present with_items: '{{ tomcat_agents_required_libs }}' -- name: Tomcat agent installation | Ensure install path +- name: Tomcat | agent installation | Ensure install path file: path: "{{ tomcat_install_path }}/{{ item.name }}" state: directory @@ -14,7 +14,7 @@ group: "{{ tomcat_group }}" with_items: '{{ tomcat_agents_config }}' -- name: Tomcat agent installation | Check if agent is installed +- name: Tomcat | agent installation | Check if agent is installed stat: path: "{{ tomcat_install_path }}/{{ item.0.name }}/{{ item.1 | basename }}" register: agent_file_exists @@ -22,16 +22,31 @@ - "{{ tomcat_agents_config }}" - catalina_opts -- name: Tomcat agent installation | Download agent +- name: Tomcat | agent installation | Check agent version + command: "cat {{ tomcat_install_path }}/{{ item.0.name }}/version.txt" + register: agent_version_checked + changed_when: false + ignore_errors: true + with_subelements: + - "{{ tomcat_agents_config }}" + - catalina_opts +- debug: + msg: "mierduza extrema {{ agent_version_checked }} " + +- name: Tomcat | agent installation | Download agent get_url: dest: "/tmp" url: "{{ item.download_url }}" owner: "{{ tomcat_user }}" group: "{{ tomcat_group }}" register: agent_downloaded - with_items: '{{ tomcat_agents_config }}' + loop: "{{ tomcat_agents_config|flatten(levels=1) }}" + loop_control: + index_var: index + when: tomcat_agents_force_reinstall or not agent_file_exists.results[index].stat.exists or item.version != agent_version_checked.results[index].stdout or agent_version_checked.results[index].failed + -- name: Tomcat agent installation | Unarchive package +- name: Tomcat | agent installation | Unarchive package unarchive: src: "/tmp/{{ item.download_url | basename }}" dest: "{{ tomcat_install_path }}" @@ -44,30 +59,41 @@ tags: - skip_ansible_lint -- name: Tomcat agent installation | Check configuration files +- name: Tomcat | agent installation | Copy version number file + template: + src: "agents/version.txt.j2" + dest: "{{ tomcat_install_path }}/{{ item.name }}/version.txt" + owner: "{{ tomcat_user }}" + group: "{{ tomcat_group }}" + mode: 0644 + with_items: '{{ tomcat_agents_config }}' + +- name: Tomcat | agent installation | Check configuration files set_fact: tomcat_agent_configuration: "{{ tomcat_agent_configuration|default([]) + [ {'name': item.0.name, 'file': item.1, 'params': item.0.params}] }}" with_subelements: - "{{ tomcat_agents_config }}" - configuration_files -- name: Tomcat agent installation | Configure the Java agent +- name: Tomcat | agent installation | Configure the Java agent template: src: "{{ playbook_dir }}/templates/tomcat/agents/{{ item.name }}/{{ item.file }}.j2" dest: "{{ tomcat_install_path }}/{{ item.name }}/{{ item.file }}" owner: "{{ tomcat_user }}" group: "{{ tomcat_group }}" + when: agent_downloaded.changed + notify: restart tomcat with_items: - '{{ tomcat_agent_configuration }}' -- name: Tomcat agent installation | Check catalina options +- name: Tomcat | agent installation | Check catalina options set_fact: tomcat_agent_catalina_opts: "{% set tomcat_agent_catalina_opts = tomcat_agent_catalina_opts|default([]) + [item.1] %}{{ tomcat_agent_catalina_opts|list }}" with_subelements: - "{{ tomcat_agents_config }}" - catalina_opts -- name: Tomcat agent installation | Configure catalina options +- name: Tomcat | agent installation | Configure catalina options template: src: "{{ item.src }}" dest: "{{ item.dest }}" diff --git a/templates/agents/version.txt.j2 b/templates/agents/version.txt.j2 new file mode 100644 index 0000000..208fd93 --- /dev/null +++ b/templates/agents/version.txt.j2 @@ -0,0 +1 @@ +{{ item.version }} \ No newline at end of file From b2d6fcd3cd11f3f081185f311ae78c054bd9ef91 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Sun, 17 May 2020 22:24:09 +0200 Subject: [PATCH 11/18] [#66] Improve agents management. Removed unwanted change :) --- tasks/agent.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tasks/agent.yml b/tasks/agent.yml index ffa9f64..206117b 100644 --- a/tasks/agent.yml +++ b/tasks/agent.yml @@ -30,8 +30,6 @@ with_subelements: - "{{ tomcat_agents_config }}" - catalina_opts -- debug: - msg: "mierduza extrema {{ agent_version_checked }} " - name: Tomcat | agent installation | Download agent get_url: From 092892e005facf3e44d18e5d12625d4260b148a1 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Mon, 18 May 2020 16:29:59 +0200 Subject: [PATCH 12/18] [#64] Adding testing scenarios for tomcat 7.x and 8.x --- .travis.yml | 8 +++++++- CHANGELOG.md | 1 + defaults/main.yml | 2 +- molecule/default/molecule.yml | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 583369d..654f017 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,14 @@ services: install: - pip install pipenv - pipenv sync +env: + matrix: + - TOMCAT_VERSION=9.0.35 + - TOMCAT_VERSION=8.5.55 + - TOMCAT_VERSION=7.0.104 + - TOMCAT_VERSION=10.0.0-M5 script: - - pipenv run molecule test --all + - pipenv run molecule test notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 6731f5f..aa05ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch - *[#61](https://github.com/idealista/tomcat_role/issues/61) Update molecule to 3.x* @sorobon - *[#63](https://github.com/idealista/tomcat_role/issues/63) Rename role to tomcat_role* @sorobon - *[#66](https://github.com/idealista/tomcat_role/issues/66) Improve agents management* @sorobon +- *[#64](https://github.com/idealista/tomcat_role/issues/64) Adding testing scenarios for tomcat 7.x and 8.x* @sorobon ## [1.8.0](https://github.com/idealista/tomcat_role/tree/1.8.0) [Full Changelog](https://github.com/idealista/tomcat_role/compare/1.7.0...1.8.0) diff --git a/defaults/main.yml b/defaults/main.yml index 041ae54..355d427 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,7 +2,7 @@ ## General -tomcat_version: 9.0.34 +tomcat_version: 9.0.35 ## Service options diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index a4aecee..462bcfe 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -26,6 +26,10 @@ platforms: provisioner: name: ansible + inventory: + group_vars: + tomcat: + tomcat_version: ${TOMCAT_VERSION} verifier: name: ansible directory: ./tests From 80fe5fe231b3e4440c71f22fe9fb03aa9edcab51 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Mon, 18 May 2020 16:39:08 +0200 Subject: [PATCH 13/18] [#64] Adding testing scenarios for tomcat 7.x and 8.x. Used as a template verify.yml --- molecule/default/tests/test_tomcat.yml | 2 +- molecule/default/verify.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/molecule/default/tests/test_tomcat.yml b/molecule/default/tests/test_tomcat.yml index 5b3fbe0..fce9c57 100644 --- a/molecule/default/tests/test_tomcat.yml +++ b/molecule/default/tests/test_tomcat.yml @@ -63,4 +63,4 @@ command: java -cp /opt/tomcat/lib/catalina.jar org.apache.catalina.util.ServerInfo | grep 'Server version': exit-status: 0 stdout: - - "9.0.34" \ No newline at end of file + - "{{ tomcat_version }}" \ No newline at end of file diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index 18be02a..be565e0 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -11,6 +11,7 @@ goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" goss_test_directory: /tmp goss_format: documentation + tomcat_version: "{{ molecule_yml.provisioner.inventory.group_vars.tomcat.tomcat_version }}" tasks: - name: Download and install Goss get_url: @@ -23,7 +24,7 @@ retries: 3 - name: Copy Goss tests to remote - copy: + template: src: "{{ item }}" dest: "{{ goss_test_directory }}/{{ item | basename }}" with_fileglob: From 03c682cc6123db74479256f31d3fa702eb1bbdcd Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Mon, 18 May 2020 16:52:43 +0200 Subject: [PATCH 14/18] [#64] Adding testing scenarios for tomcat 7.x and 8.x. Removed tomcat 10.x --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 654f017..463ca02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ env: - TOMCAT_VERSION=9.0.35 - TOMCAT_VERSION=8.5.55 - TOMCAT_VERSION=7.0.104 - - TOMCAT_VERSION=10.0.0-M5 script: - pipenv run molecule test From 2d7ceff7cebe2e352b25937c92351dd178b15971 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Mon, 18 May 2020 17:06:17 +0200 Subject: [PATCH 15/18] [#64] Adding testing scenarios for tomcat 7.x and 8.x. Added in readme and fixed goss badge --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f269a9..1c2b9c6 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,11 @@ This ansible role installs a Tomcat server in a debian environment. ## Getting Started These instructions will get you a copy of the role for your ansible playbook. Once launched, it will install a [Tomcat](https://tomcat.apache.org/) server in a Debian system. +Supported tomcat versions: +- 7.x +- 8.x +- 8.5.x +- 9.x ### Prerequisities @@ -90,7 +95,7 @@ See molecule/molecule.yml to check possible testing platforms. ![Ansible](https://img.shields.io/badge/ansible-2.8.6-green.svg) ![Molecule](https://img.shields.io/badge/molecule-3.0.4-green.svg) -![Goss](https://img.shields.io/badge/goss-0.3-11-green.svg) +![Goss](https://img.shields.io/badge/goss-0.3.11-green.svg) ## Versioning From 34ec8e0c04f9390c40a68cd9c34bd50a921b0af2 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Mon, 18 May 2020 18:20:49 +0200 Subject: [PATCH 16/18] [#64] Adding testing scenarios for tomcat 7.x and 8.x. Changed matrix in travis config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 463ca02..a34808c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - pip install pipenv - pipenv sync env: - matrix: + jobs: - TOMCAT_VERSION=9.0.35 - TOMCAT_VERSION=8.5.55 - TOMCAT_VERSION=7.0.104 From ad7545aa98dfccb8e5a9a859880e8441b175a401 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Mon, 18 May 2020 19:43:04 +0200 Subject: [PATCH 17/18] [#69] Improve systemd template adding limits --- CHANGELOG.md | 1 + defaults/main.yml | 5 +++++ templates/tomcat.service.j2 | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa05ec0..1d32579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch - *[#63](https://github.com/idealista/tomcat_role/issues/63) Rename role to tomcat_role* @sorobon - *[#66](https://github.com/idealista/tomcat_role/issues/66) Improve agents management* @sorobon - *[#64](https://github.com/idealista/tomcat_role/issues/64) Adding testing scenarios for tomcat 7.x and 8.x* @sorobon +- *[#69](https://github.com/idealista/tomcat_role/issues/69) Improve systemd template adding limits* @sorobon ## [1.8.0](https://github.com/idealista/tomcat_role/tree/1.8.0) [Full Changelog](https://github.com/idealista/tomcat_role/compare/1.7.0...1.8.0) diff --git a/defaults/main.yml b/defaults/main.yml index 355d427..33bafcf 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -99,6 +99,11 @@ tomcat_default_log_catalina_out: '"$CATALINA_BASE"/logs' tomcat_default_log_logging_path: "${catalina.base}/logs" tomcat_default_log_valves: "logs" +tomcat_memlock_limit: "unlimited" +tomcat_nofile_limit: 100000 +tomcat_as_limit: "unlimited" +tomcat_nproc_limit: 8096 + ## Agent configuration (optional) tomcat_agents_force_reinstall: false # tomcat_agents_required_libs: diff --git a/templates/tomcat.service.j2 b/templates/tomcat.service.j2 index 576975a..5ab5564 100644 --- a/templates/tomcat.service.j2 +++ b/templates/tomcat.service.j2 @@ -12,6 +12,10 @@ ExecStop={{ tomcat_bin_path }}/shutdown.sh User={{ tomcat_user }} Group={{ tomcat_group }} +LimitMEMLOCK={{ tomcat_memlock_limit }} +LimitNOFILE={{ tomcat_nofile_limit }} +LimitAS={{ tomcat_as_limit }} +LimitNPROC={{ tomcat_nproc_limit }} [Install] WantedBy=multi-user.target From 087e22fa17899ffb72cff8d442152b740e2a5490 Mon Sep 17 00:00:00 2001 From: Santiago Orobon Date: Tue, 19 May 2020 10:14:11 +0200 Subject: [PATCH 18/18] update changelog with release 1.9.0 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d32579..a109cf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## [Unreleased](https://github.com/idealista/tomcat_role/tree/develop) + +## [1.9.0](https://github.com/idealista/tomcat_role/tree/1.9.0) +[Full Changelog](https://github.com/idealista/tomcat_role/compare/1.8.0...1.9.0) ### Changed - *[#61](https://github.com/idealista/tomcat_role/issues/61) Update molecule to 3.x* @sorobon - *[#63](https://github.com/idealista/tomcat_role/issues/63) Rename role to tomcat_role* @sorobon