Skip to content

Commit

Permalink
Merge pull request #29 from dcos/fix-molecule
Browse files Browse the repository at this point in the history
fixed molecule
  • Loading branch information
sebbrandt87 authored Apr 26, 2019
2 parents 4420c43 + ed45872 commit 01a2216
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline {
}
steps {
retry(3) {
sh("pip install ansible-lint==4.0.1 yamllint==1.11.1")
sh("pip install -r test_requirements.txt")
}
sh("yamllint -c .yamllint.yml .")
sh("ansible-lint roles/")
Expand Down
10 changes: 5 additions & 5 deletions molecule/ec2/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
instance: "{{ item.name }}"
molecule_region: "{{ item.region }}"
molecule_ssh_user: "{{ item.ssh_user | default(ssh_user) }}"
wait: true
wait: yes
exact_count: 1
count_tag:
instance: "{{ item.name }}"
Expand All @@ -113,9 +113,9 @@
set_fact:
instance_conf_dict: {
'instance': "{{ item.instances[0].tags.instance }}",
'region': "{{ item.instances[0].tags['molecule_region'] }}",
'region': "{{ item.instances[0].tags.molecule_region }}",
'address': "{{ item.instances[0].public_ip }}",
'user': "{{ item.instances[0].tags['molecule_ssh_user'] }}",
'user': "{{ item.instances[0].tags.molecule_ssh_user }}",
'port': "{{ ssh_port }}",
'identity_file': "{{ keypair_path }}",
'instance_ids': "{{ item.instance_ids }}", }
Expand All @@ -136,10 +136,10 @@

- name: Wait for SSH
wait_for:
port: "{{ ssh_port }}"
port: "{{ item.port }}"
host: "{{ item.address }}"
search_regex: SSH
delay: 10
delay: 60
timeout: 320
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"

Expand Down
2 changes: 2 additions & 0 deletions roles/DCOS.agent/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Same version config updates for nodes that are on the same version, but differ in `dcos-config--setup` package version
- name: "Same version config update? Register latest DC/OS-config--setup version from bootstrap"
shell: |
set -o pipefail
curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/package_lists/$(curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/cluster-package-list.latest).package_list.json | \
jq -r '.[] | select(.|test("dcos-config--setup"))' | sed s/dcos-config--//
args:
Expand All @@ -33,6 +34,7 @@

- name: "Same version config update? Is latest DC/OS-config--setup package installed?"
shell: |
set -o pipefail
/opt/mesosphere/bin/dcos-path/dcos-shell pkgpanda list | grep {{ latest_dcos_config_setup.stdout }}
args:
executable: bash
Expand Down
14 changes: 11 additions & 3 deletions roles/DCOS.bootstrap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@

- name: Purge old upgrade directory
file:
path: "{{ download_path }}/genconf/serve"
path: "{{ download_path }}/genconf/serve/*"
state: absent
when: "dcos['version'] is version('1.9', '>=')"
loop: >
{{ groups['dcos'] | default([]) | map('extract',hostvars,'ansible_local')| list |
select('defined') | selectattr('dcos_installation', 'defined') |
map(attribute='dcos_installation') | map(attribute='version') | list |
union([dcos['version_to_upgrade_from'] | default(dcos['version']) ]) | unique }}
- name: Ceate install directory/genconf
file: path={{ download_path }}/genconf state=directory mode=0755
Expand Down Expand Up @@ -171,7 +177,9 @@
union([dcos['version_to_upgrade_from'] | default(dcos['version']) ]) | unique }}
- name: Get upgrade directory hash
shell: "ls -td -- */ | head -n 1 | cut -d'/' -f1"
shell: |
set -o pipefail
ls -td -- */ | head -n 1 | cut -d'/' -f1
args:
chdir: "{{ download_path }}/genconf/serve/upgrade_from_{{ item }}"
changed_when: false
Expand All @@ -189,7 +197,7 @@
src: "{{ item.stdout }}"
state: link
when: "dcos['version'] is version('1.9', '>=')"
loop: "{{upgrade_dir_hash.results}}"
loop: "{{ upgrade_dir_hash.results }}"

# vvv serve files via http vvv

Expand Down
6 changes: 5 additions & 1 deletion roles/DCOS.master/tasks/dcos_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# Step 1 on upgrading prcedure
- name: "Upgrade: Check for all-green Exhibitor status"
shell: |
set -o pipefail
curl --silent http://localhost:8181/exhibitor/v1/cluster/status | jq -r '.[].description' | uniq
args:
warn: false # Curl inside shell is what we need, silence warning.
Expand All @@ -50,7 +51,9 @@
port: 5050
delay: 10
- name: "Upgrade: Check for mesos-master systemd unit to be 'running'"
shell: systemctl status dcos-mesos-master | grep '(running)'
shell: |
set -o pipefail
systemctl status dcos-mesos-master | grep '(running)'
args:
warn: false # We are not interested in changing the state itself, just if it's 'running'
retries: 12
Expand All @@ -60,6 +63,7 @@
# Step 5 on upgrading procedure
- name: "Upgrade: Check for CockrockDB replication status (Enterprise only)"
shell: |
set -o pipefail
/opt/mesosphere/bin/cockroach node status --ranges --certs-dir=/run/dcos/pki/cockroach --host=$(/opt/mesosphere/bin/detect_ip) --format tsv 2>/dev/null | tail -n+2 | head -n-1 | cut -f 10 | uniq
retries: 12
delay: 10
Expand Down
2 changes: 2 additions & 0 deletions roles/DCOS.master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Same version config updates for nodes that are on the same version, but differ in `dcos-config--setup` package version
- name: "Same version config update? Register latest DC/OS-config--setup version from bootstrap"
shell: |
set -o pipefail
curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/package_lists/$(curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/cluster-package-list.latest).package_list.json | \
jq -r '.[] | select(.|test("dcos-config--setup"))' | sed s/dcos-config--//
args:
Expand All @@ -33,6 +34,7 @@

- name: "Same version config update? Is latest DC/OS-config--setup package installed?"
shell: |
set -o pipefail
/opt/mesosphere/bin/dcos-path/dcos-shell pkgpanda list | grep {{ latest_dcos_config_setup.stdout }}
args:
executable: bash
Expand Down
6 changes: 3 additions & 3 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
molecule==2.19.0
molecule==2.20.1
molecule[ec2]
molecule[vagrant]
boto
boto3
ansible-lint==4.0.1
yamllint==1.11.1
ansible-lint==4.1.0
yamllint==1.15.0

0 comments on commit 01a2216

Please sign in to comment.