stages:
  - test

variables:
  GIT_DEPTH: "1"
  DEBIAN_FRONTEND: noninteractive

before_script:
  - apt update && apt -y install python3-pip tar wget openssh-client openssh-server rsync || dnf -y install python3-pip tar wget openssh openssh-server rsync || yum -y install python3-pip tar wget openssh-client openssh-server rsync
  - ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<<y 2>&1 >/dev/null
  - cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  - pip3 install -U pip -i https://mirrors.aliyun.com/pypi/simple/
  - pip install -U ansible==2.9 -i https://mirrors.aliyun.com/pypi/simple/
  - ansible --version
  - wget -O - https://minio.mycard.moe:9000/nanahira/mitogen-0.2.9.tar.gz | tar zxvf -
  - cp tests/ansible.cfg .
  - chmod 700 .


vm:
  stage: test
  tags: 
    - vc
  script:
    - systemctl start sshd
    - ansible-playbook tests/test.yml --syntax-check
    - ansible-playbook tests/test.yml
