---
kind: pipeline
type: docker
name: Static Verification
steps:
  - name: ansible-lint
    image: python:3.10.6
    commands:
      # Make sure to update the ansible version below as well
      - pip --disable-pip-version-check install ansible==7.2.0 ansible-lint==6.16.1 > /dev/null 2> /dev/null
      - ansible-lint -c .ansible-lint ansible

---
kind: pipeline
type: docker
name: Check
steps:
  - name: ansible-playbook --check
    image: python:3.10.6
    environment:
      SSH_KEY:
        from_secret: ssh_key
      VAULT_PASSWORD:
        from_secret: vault_password
    commands:
      - pip install ansible==7.2.0 > /dev/null 2> /dev/null

      - mkdir "$HOME/.ssh"
      - echo "$SSH_KEY" > "$HOME/.ssh/id"
      - chmod 0600 ~/.ssh/id
      - ssh-keyscan -p 2309 vmd98928.contaboserver.net > "$HOME/.ssh/known_hosts"

      - echo "$VAULT_PASSWORD" > "$HOME/vault_password"

      - cd ansible
      - ansible-playbook --private-key "$HOME/.ssh/id" --vault-password-file "$HOME/vault_password" --check playbooks/misc-all.yaml