summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 01b1a304cf7b1582c551f925660ca6861c122234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
stages:          # List of stages for jobs, and their order of execution
  - test
  - deploy

lint-test-job:  
  stage: test 
  image: pipelinecomponents/ansible-lint 
  script:
    - ansible-lint -p lamp.yml | ansible-lint-junit -o ansible-lint.xml  || true
  artifacts:
     when: always
     reports:
        junit: ansible-lint.xml 

deploy-job:      
  stage: deploy
  image: ansible
  before_script:
    - mkdir -p ~/.ssh
    - ssh-keyscan -H ansible-debian.xlinfo.lan > ~/.ssh/known_hosts
    - ssh-keyscan -H ansible-rocky.xlinfo.lan >> ~/.ssh/known_hosts
    - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
    - chmod 600 ~/.ssh/id_rsa
    - chmod 700 ~/.ssh/
  script:
    - ansible-playbook lamp.yml -i hosts