Chapter 15 - Docker and Ansible415When building from aDockerfile, you can set things like theUSER(the user used torun theCMDorENTRYPOINTin the container) andCMD(the defaults for an executingcontainer) directly. In our case, since we’re not building from aDockerfile, we setthese options usingdocker commit’s-cor--changeoption.Now that we have the main scaffolding in place for building a Docker container,committing an image from that container, and tearing down the container, it’s timeto add the ‘meat’ to our playbook—the role that installs Hubot and its Slack adapter.Building thehubot-slackroleAs with any role, the easiest way to scaffold the necessary files is using theansible-galaxycommand. Create ahubot-slackrole in arolessubdirectory with:ansible-galaxy role init hubot-slackYou can delete some unneeded role directories, namelyfiles,handlers,templates,tests, andvars. If you want, fill in the metadata fields insidemeta/main.yml(this isonly needed if you’re publishing the role on Ansible Galaxy or if you need to haveother roles defined as dependencies, though).Since Hubot isn’t too hard to install, we can do everything we need insidetasks/main.yml.The first thing we need to do is ensure all the required dependencies for generatingour bot are present:1---2- name: Install dependencies.3package:4name: sudo5state: present67- name: Install required Node.js packages.8npm:9name: "{{ item }}"10state: present11global: yes12with_items: