Przeglądaj źródła

Merge pull request #146 from Shubhangi-dell/devel

Issue #145 :Creating common storage for provision and web_ui containers
Lucas A. Wilson 4 lat temu
rodzic
commit
e12e74351b

+ 26 - 0
appliance/appliance.yml

@@ -0,0 +1,26 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Executing omnia roles
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  roles:
+    - common
+    - provision
+    - core
+    - web_ui
+

+ 3 - 0
appliance/roles/common/files/daemon.json

@@ -0,0 +1,3 @@
+{
+    "bip": "172.18.0.3/16"
+}

+ 56 - 0
appliance/roles/common/tasks/docker_installation.yml

@@ -0,0 +1,56 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Add docker repo
+  get_url:
+    url: "{{ docker_repo_url }}"
+    dest: "{{ docker_repo_dest }}"
+  tags: install
+
+- name: Enable docker edge and test repo
+  ini_file:
+    dest: "{{ docker_repo_dest }}"
+    section: "{{ item }}"
+    option: enabled
+    value: "{{ success }}"
+  with_items: ['docker-ce-test', 'docker-ce-edge']
+  tags: install
+
+- name: Install docker
+  package:
+    name: "{{ container_repo_install }}" 
+    state: latest
+  become: yes
+  tags: install
+
+- name: Start services
+  service:
+    name: "{{ container_type }}"
+    state: started
+    enabled: yes
+  become: yes
+  tags: install
+
+- name: Installation using python3
+  pip:
+    name: "{{ docker_compose }}"
+    executable: pip3
+  tags: install
+
+- name: Configure docker
+  copy:
+    src: daemon.json
+    dest: "{{ daemon_dest }}"
+  tags: install

+ 19 - 0
appliance/roles/common/tasks/docker_volume.yml

@@ -0,0 +1,19 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Create a docker volume
+  docker_volume:
+    name: "{{ docker_volume_name }}"
+

+ 25 - 0
appliance/roles/common/tasks/internet_validation.yml

@@ -0,0 +1,25 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Internet connectivity status
+  wait_for:
+    host: "{{ hostname }}"
+    port: "{{ port_no }}"
+    state: started
+    delay: "{{ internet_delay }}"
+    timeout: "{{ internet_timeout }}"
+    msg: "{{ internet_status }}"
+  register: internet_value
+  tags: install

+ 29 - 0
appliance/roles/common/tasks/main.yml

@@ -0,0 +1,29 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Pre-requisite validation
+  import_tasks: pre_requisite.yml
+
+- name: Internet validation
+  import_tasks: internet_validation.yml
+
+- name: Common packages installation
+  import_tasks: package_installation.yml
+
+- name: Docker installation and configuration
+  import_tasks: docker_installation.yml
+
+- name: Docker volume creation
+  import_tasks: docker_volume.yml

+ 20 - 0
appliance/roles/common/tasks/package_installation.yml

@@ -0,0 +1,20 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Install packages
+  package:
+    name: "{{ common_packages }}"
+    state: latest
+  tags: install

+ 40 - 0
appliance/roles/common/tasks/pre_requisite.yml

@@ -0,0 +1,40 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Set omnia.log file
+  replace:
+    path: /etc/ansible/ansible.cfg
+    regexp: '#log_path = /var/log/ansible.log'
+    replace: 'log_path = /var/log/omnia.log'
+  tags: install
+
+- name: Check OS support 
+  fail: 
+    msg: "{{ os_status }}"
+  when: not(ansible_distribution == os_name and ansible_distribution_version >= os_version)
+  register: os_value
+  tags: install
+
+- name: Disable SElinux
+  selinux:
+    state: disabled
+  tags: install
+
+- name: Status of SElinux
+  fail: 
+    msg: "{{ selinux_status }}"
+  when: ansible_selinux.status != 'disabled'
+  register: selinux_value
+  tags: install

+ 54 - 0
appliance/roles/common/vars/main.yml

@@ -0,0 +1,54 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+# vars file for common
+
+# Usage: package_installation.yml
+common_packages:
+  - epel-release
+  - yum-utils
+  - git
+  - gcc
+  - gcc-c++
+  - nodejs
+  - device-mapper-persistent-data
+  - bzip2
+  - python3-pip
+  - nano
+  - lvm2
+  - gettext
+
+# Usage: pre_requisite.yml
+internet_delay: 0
+internet_timeout: 1
+hostname: github.com
+port_no: 22
+os_name: CentOS
+os_version: '8'
+internet_status: "Failed:No Internet connection.Connect to Internet."
+os_status: "Unsupported OS or OS version.OS must be {{ os_name }} and Version must be {{ os_version }} or more"
+selinux_status: "SElinux is not disabled. Disable it in /etc/sysconfig/selinux and reboot the system"
+
+# Usage: docker_installation.yml
+docker_repo_url: https://download.docker.com/linux/centos/docker-ce.repo
+docker_repo_dest: /etc/yum.repos.d/docker-ce.repo
+success: '0'
+container_type: docker
+container_repo_install: docker-ce
+docker_compose: docker-compose
+daemon_dest: /etc/docker/
+
+# Usage: docker_volume.yml
+docker_volume_name: omnia-storage

+ 21 - 0
appliance/roles/core/tasks/main.yml

@@ -0,0 +1,21 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+
+---
+
+- name: Install core  is called
+  debug:
+    msg:
+      - "core container is created"
+

+ 2 - 0
appliance/roles/core/vars/main.yml

@@ -0,0 +1,2 @@
+---
+# vars file for core

+ 20 - 0
appliance/roles/provision/tasks/main.yml

@@ -0,0 +1,20 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+---
+
+- name: Install cobbler is called
+  debug:
+    msg:
+      - "cobbler file called"
+

+ 2 - 0
appliance/roles/provision/vars/main.yml

@@ -0,0 +1,2 @@
+---
+# vars file for provision

+ 21 - 0
appliance/roles/web_ui/tasks/main.yml

@@ -0,0 +1,21 @@
+#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  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.
+
+---
+
+- name: Install awx is called
+  debug:
+    msg:
+      - "awx installation started"
+

+ 2 - 0
appliance/roles/web_ui/vars/main.yml

@@ -0,0 +1,2 @@
+---
+# vars file for web-ui