main.yml #3

  • //
  • guest/
  • russell_jackson/
  • ansible-sdp/
  • roles/
  • perforce-sdp-install/
  • tasks/
  • main.yml
  • View
  • Commits
  • Open Download .zip Download (2 KB)
---
# tasks file for ansible-perforce_sdp_install

# Run on ALL Hosts based on var
- name: "Run clean commands"
  shell: "{{ item }}"
  ignore_errors: yes
  with_items:
    - "{{ perforce_clean_commands }}"
  when: perforce_clean

- name: "Run data volume clean"
  shell: "rm -rf /{{ perforce_data_volume }}/p4"
  when: (perforce_clean) and (not perforce_depots_use_nfs)

# Run on ALL Hosts based on var
- name: "Run network_clean_redhat commands"
  shell: "{{ item }}"
  ignore_errors: yes
  with_items:
    - "{{ network_clean_redhat }}"
  when: perforce_clean and ansible_facts["os_family"]=="RedHat" and dummy_interface

# Run on ALL Hosts based on var
- name: "Run network_clean_debian commands"
  shell: "{{ item }}"
  ignore_errors: yes
  with_items:
    - "{{ network_clean_debian }}"
  when: perforce_clean and ansible_facts["os_family"]=="Debian" and dummy_interface

# Run on ALL hosts based on var 
- name: "Include dependencies"
  include_tasks: "dependencies.yml"
  when: update_dependencies

# Run on ALL hosts
- name: "Include installation"
  include_tasks: "install.yml"
  when: new_sdp

# Run on ALL hosts
- name: "Include cron"
  include_tasks: "cron.yml"

- name: "Copy id_rsa"
  copy:
    src: "./id_rsa"
    dest: "/p4/.ssh/id_rsa"
    decrypt: yes
    owner: "{{ perforce_user }}"
    group: "{{ perforce_group }}"
    mode: '0600'

- name: "Add ssh config lines"
  blockinfile:
    path: "/p4/.ssh/config"
    create: yes
    owner: "{{ perforce_user }}"
    group: "{{ perforce_group }}"
    insertafter: "EOF"
    block: |
      PasswordAuthentication no
      StrictHostKeyChecking no

- name: "Ensure authorized_keys exists for perforce user"
  file:
    path: "/p4/.ssh/authorized_keys"
    state: touch
    owner: "{{ perforce_user }}"
    group: "{{ perforce_group }}"
    mode: '0600'

# Change User Description Committed
#3 32493 Russell C. Jackson (Rusty) Created some dummy files to allow the install to run.
#2 32492 Russell C. Jackson (Rusty) Fix bugs, remove orphaned files, and apply best practices to ansible-sdp

- Fix broken Jinja2 filter syntax (|bool|) in main-playbook.yml
- Fix target_server logic comparing string literals instead of variables
- Fix package install failing on RedHat due to missing OS family guard
- Split packages into OS-agnostic and Debian-specific lists, remove duplicates
- Switch all binary downloads from HTTP to HTTPS
- Remove 7 orphaned files (unused templates, scripts, configs)
- Replace hardcoded emails in cron with template variables
- Fix inconsistent journal rotations (06:00/08:00) to use rotate_journal.sh
- Parameterize admin sudoers and perforce user password
- Fix ansible.cfg malformed vars block
- Fix ansibleuser sudo group for RedHat (wheel) vs Debian (sudo)
- Remove redundant triple broker start/restart in install.yml
- Replace shell sed with ansible.builtin.replace in monitoring role
- Fix duplicate handler and undefined variable in monitoring handlers
- Use notify handlers instead of inline commands for sysctl/THP
- Add idempotency (creates:) to pyenv install
#1 32488 Russell C. Jackson (Rusty) Ansible scaffolding for the sdp - Needs work.