Skip to content

Commit

Permalink
fix missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Mar 5, 2020
1 parent 883fd17 commit 034e613
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 0 deletions.
17 changes: 17 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- import_playbook: ../../playbooks/converge.yml
73 changes: 73 additions & 0 deletions molecule/default/create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---

# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: copy template
template:
src: "{{ molecule_scenario_directory }}/{{ item.dockerfile }}"
dest: "{{ molecule_ephemeral_directory }}/Dockerfile-{{ item.name }}"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
when: item.dockerfile is defined

- name: docker build
docker_image:
name: "{{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\\1') }}:{{ item.name }}"
source: "build"
build:
path: "{{ molecule_ephemeral_directory }}"
dockerfile: "{{ molecule_ephemeral_directory }}/Dockerfile-{{ item.name }}"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
when: item.dockerfile is defined

- name: docker pull
docker_image:
name: "{{ item.image }}"
source: "pull"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
when: item.dockerfile is not defined

- name: docker tag
docker_image:
name: "{{ item.image }}"
repository: "{{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\\1') }}:{{ item.name }}"
source: "local"
force_tag: true
loop: "{{ molecule_yml.platforms }}"
when: item.dockerfile is not defined

- name: docker run
docker_container:
name: "{{ item.name }}"
image: "{{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\\1') }}:{{ item.name }}"
entrypoint: "{{ item.entrypoint | default('') }}"
command: "{{ item.command | default('bash -c \"sleep infinity\"') }}"
privileged: "{{ item.privileged | default(omit) }}"
tty: "{{ item.tty | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
env: "{{ item.env | default(omit) }}"
state: "started"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
27 changes: 27 additions & 0 deletions molecule/default/destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: docker rm
docker_container:
name: "{{ item.name }}"
state: "absent"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
1 change: 1 addition & 0 deletions molecule/default/group_vars/all/00-defaults.yml
17 changes: 17 additions & 0 deletions molecule/default/group_vars/all/99-molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

fisheye_version: "4.8.1"
74 changes: 74 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---

# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- hosts: all
remote_user: root
become: true
gather_facts: false
tasks:
- name: cp -rfT /etc/skel /root
raw: |
cp -rfT /etc/skel /root
changed_when: false
ignore_errors: true

- name: setenforce 0
raw: |
setenforce 0
changed_when: false
ignore_errors: true

- name: systemctl stop firewalld.service
raw: |
systemctl stop firewalld.service
changed_when: false
ignore_errors: true

- name: systemctl stop ufw.service
raw: |
systemctl stop ufw.service
changed_when: false
ignore_errors: true

- name: redhat-7 | subscription-manager register
raw: |
subscription-manager register \
--username={{ lookup('env', 'REDHAT_USERNAME') }} \
--password={{ lookup('env', 'REDHAT_PASSWORD') }} \
--autosubscribe
changed_when: false
ignore_errors: true

- name: debian | apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo
raw: |
apt-get update
apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo
changed_when: false
ignore_errors: true

- name: redhat | yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo
raw: |
yum makecache fast
yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo
changed_when: false
ignore_errors: true

- name: suse | zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo
raw: |
zypper -n --gpg-auto-import-keys refresh
zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo
changed_when: false
ignore_errors: true
43 changes: 43 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---

# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: docker image inspect
docker_image_info:
name: "{{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\\1') }}:{{ item.name }}"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
register: result

- name: docker commit
shell: |
set -o pipefail
docker inspect {{ item.name }} && docker commit \
--change 'CMD ["{{ result.results[i].images[0].Config.Cmd | join('", "') }}"]' \
--change 'ENTRYPOINT ["{{ result.results[i].images[0].Config.Entrypoint | join('", "') }}"]' \
{{ item.name }} {{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\1') }}:{{ item.name }}-commit
args:
executable: "/bin/bash"
loop_control:
label: "{{ item.name }}"
index_var: i
with_items: "{{ molecule_yml.platforms }}"
changed_when: false
ignore_errors: true

0 comments on commit 034e613

Please sign in to comment.