Beispiel #1
0
 def test_construct_playbook_command(self):
     command = construct_playbook_command(
         'tests/playbooks/simple-playbook.yml', ['127.0.0.1'])
     self.assertEqual(command, [
         'ansible-playbook', 'tests/playbooks/simple-playbook.yml', '-i',
         '127.0.0.1,'
     ])
Beispiel #2
0
 def test_construct_playbook_command_with_host_name(self):
     command = construct_playbook_command(
         'tests/playbooks/simple-playbook.yml', 'hosts')
     self.assertEqual(command, [
         'ansible-playbook', 'tests/playbooks/simple-playbook.yml', '-i',
         'hosts'
     ])
Beispiel #3
0
 def test_construct_playbook_command_with_private_key(self):
     command = construct_playbook_command(
         'tests/playbooks/simple-playbook.yml', ['127.0.0.1'],
         private_key='/home/foo/id_rsa')
     self.assertEqual(command, [
         'ansible-playbook', 'tests/playbooks/simple-playbook.yml', '-i',
         '127.0.0.1,', '--private-key=/home/foo/id_rsa'
     ])
Beispiel #4
0
 def test_construct_playbook_command_with_specific_ansible_command(self):
     command = construct_playbook_command(
         'tests/playbooks/simple-playbook.yml', ['127.0.0.1'],
         playbook_command='/bin/ansible-playbook')
     self.assertEqual(command, [
         '/bin/ansible-playbook', 'tests/playbooks/simple-playbook.yml',
         '-i', '127.0.0.1,'
     ])
Beispiel #5
0
 def test_construct_playbook_command_with_extra_options(self):
     command = construct_playbook_command(
         'tests/playbooks/simple-playbook.yml', ['127.0.0.1'],
         private_key='/home/foo/id_rsa',
         extra_options='--syntax-check')
     self.assertEqual(command, [
         'ansible-playbook', 'tests/playbooks/simple-playbook.yml', '-i',
         '127.0.0.1,', '--private-key=/home/foo/id_rsa', '--syntax-check'
     ])
Beispiel #6
0
 def test_construct_playbook_command_with_extra_vars(self):
     command = construct_playbook_command(
         'tests/playbooks/simple-playbook.yml', ['127.0.0.1', '127.0.0.2'],
         extra_vars={
             "extra1": "var1",
             "extra2": "var2"
         })
     print(command)
     self.assertEqual(command, [
         'ansible-playbook', 'tests/playbooks/simple-playbook.yml', '-i',
         '127.0.0.1,127.0.0.2,', '--extra-vars', '"extra1=var1 extra2=var2"'
     ])