Ansible: Can I execute role from command line?

前端 未结 7 829
陌清茗
陌清茗 2020-12-07 14:22

Suppose I have a role called \"apache\"

Now I want to execute that role on host 192.168.0.10 from the command line from Ansible host

ansible-playbook         


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-07 15:11

    in ansible 2.8 it works slightly different

    wohlgemuth@leela:~/workspace/rtmtb-ansible/kvm-cluster$ ansible localhost -m import_role -a name=rtmtb
     [WARNING]: No inventory was parsed, only implicit localhost is available
    
    localhost | CHANGED => {
        "changed": true, 
        "checksum": "d31b41e68997e1c7f182bb56286edf993146dba1", 
        "dest": "/root/.ssh/id_rsa.github", 
        "gid": 0, 
        "group": "root", 
        "md5sum": "b7831c4c72f3f62207b2b96d3d7ed9b3", 
        "mode": "0600", 
        "owner": "root", 
        "size": 3389, 
        "src": "/home/wohlgemuth/.ansible/tmp/ansible-tmp-1561491049.46-139127672211209/source", 
        "state": "file", 
        "uid": 0
    }
    localhost | CHANGED => {
        "changed": true, 
        "checksum": "1972ebcd25363f8e45adc91d38405dfc0386b5f0", 
        "dest": "/root/.ssh/config", 
        "gid": 0, 
        "group": "root", 
        "md5sum": "f82552a9494e40403da4a80e4c528781", 
        "mode": "0644", 
        "owner": "root", 
        "size": 147, 
        "src": "/home/wohlgemuth/.ansible/tmp/ansible-tmp-1561491049.99-214274671218454/source", 
        "state": "file", 
        "uid": 0
    }
    
    

提交回复
热议问题