Skip to content

Commit

Permalink
Merge pull request #56 from avinetworks/AV-111298
Browse files Browse the repository at this point in the history
AV-111298: fix controller deployment via working service file
  • Loading branch information
sabandi authored Apr 28, 2021
2 parents b7fe99f + d46402e commit d37b35b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ addons:

install:
# Install required packages
- pip install molecule yamllint ansible-lint flake8 testinfra docker molecule-docker
- pip install ansible molecule yamllint ansible-lint flake8 testinfra docker molecule-docker

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ rules:
new-line-at-end-of-file: disable
new-lines: {type: unix}
trailing-spaces: disable
truthy: disable
truthy: disable
1 change: 0 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ con_image: "avinetworks/controller:{{ con_version }}"

# docker deployment parameters
con_force_deploy: false
con_new_service: false
con_fresh_install: false
con_controller_ip: "{{ ansible_default_ipv4.address }}"
con_cores: "{{ ansible_processor_cores * ansible_processor_count }}"
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ lint: |
provisioner:
name: ansible
verifier:
name: testinfra
name: testinfra
4 changes: 2 additions & 2 deletions tasks/docker/family/redhat.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Verify if firewalld service is installed/present
- name: Avi Controller | Docker | Family | Verify Firewalld is present
command: systemctl is-enabled firewalld # noqa 303
command: systemctl is-enabled firewalld # noqa 303
register: result
failed_when: false
changed_when: false
Expand All @@ -13,7 +13,7 @@

# Verify if snmpd service is installed/present and enable
- name: Avi Controller | Docker | Family | Verify snmpd is present
command: systemctl is-enabled snmpd # noqa 303
command: systemctl is-enabled snmpd # noqa 303
register: snmpd_result
failed_when: false
changed_when: false
Expand Down
4 changes: 0 additions & 4 deletions tasks/docker/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
when: con_docker_repo != None
when: not con_package_deploy

- name: Avi Controller | Set service facts for deploy
set_fact:
con_new_service: "{{ con_version is version_compare('19.1.1', '>=') }}"

- name: Avi Controller | Docker | Cleanup
include: services/cleanup.yml

Expand Down
15 changes: 3 additions & 12 deletions tasks/docker/services/install.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
---
- block:
- name: Avi Controller | Services | systemd | Install the Avi Controller service
include: "systemd/install.yml"
when: ansible_service_mgr == "systemd"
when: not con_new_service
- name: Avi Controller | Services | systemd | Install the Avi Controller service
include: "systemd/install.yml"
when: ansible_service_mgr == "systemd"

- block:
- name: Avi Controller | Services | Install the Avi Controller service file | New
template: src=avicontroller.j2 dest=/usr/sbin/avicontroller mode=0755
notify: Avi Controller | Services | Restart the avicontroller service
- name: Avi Controller | Services | {{ ansible_service_mgr }} | Install the Avi Controller service | New
include: "{{ ansible_service_mgr }}/install.yml"
when: con_new_service

- name: Avi Controller | Services | {{ ansible_service_mgr }} | Start the service since it's not running |
service: name=avicontroller enabled=yes state=started
Expand Down
12 changes: 0 additions & 12 deletions tasks/docker/services/systemd/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,3 @@
notify:
- Avi Controller | Services | systemd | Daemon reload
- Avi Controller | Services | Restart the avicontroller service
when: not con_new_service

- name: Avi Controller | Services | systemd | Deploy the avicontroller service | New Service
copy:
src: systemd/avicontroller.service
dest: /etc/systemd/system/avicontroller.service
mode: 0644
register: avicontroller_service
notify:
- Avi Controller | Services | systemd | Daemon reload
- Avi Controller | Services | Restart the avicontroller service
when: con_new_service

0 comments on commit d37b35b

Please sign in to comment.