title: Gitlab-ci multiple images, before_script per stage and installing dependency to image
body: <p>I have some questions related to gitlab-ci</p>
  
  <ol>
  <li>How can I use more than one image? Maybe one image per stage or depend on job name?</li>
  </ol>
  
  <blockquote>
  <pre><code>####  How use one image for JobA1 and JobA2  
  
  JobA1:
      stage: Test
      script:
          - ansible-playbook testa1.yml
  
  JobA2:
      stage: Test
      script:
          - ansible-playbook testa2.yml
  
  ####  How use other image to JobB1 and JobB2  
  
  JobB1:
      stage: Test
      script:
          - ansible-playbook testa1.yml
  
  JobB2:
      stage: Test
      script:
          - ansible-playbook testa2.yml
  </code></pre>
  </blockquote>
  
  <ol start="2">
  <li>How can I use before_script depends on stage?</li>
  <li>How can I install dependency to image? I tried do it like that</li>
  </ol>
  
  <blockquote>
  <pre><code>before_script:
  - apt update
  - apt install software-properties-common
  - apt-add-repository --yes --update ppa:ansible/ansible
  - apt install ansible
  </code></pre>
  </blockquote>
  
  <p>I see in the log that the commands from before_script will execute, but when installing ansible the installation must be confirmed - how can I do it? Alternatively, is there a better way to install ansible to the image?</p>
  
  <blockquote>
  <pre><code>0 upgraded, 73 newly installed, 0 to remove and 12 not upgraded.
  Need to get 24.8 MB of archives.
  After this operation, 112 MB of additional disk space will be used.
  Do you want to continue? [Y/n] Abort.
  </code></pre>
  </blockquote>